"

2013 FRC Java API

"

com.sun.squawk.platform.windows.natives
Class SocketImpl

java.lang.Object
  extended by com.sun.squawk.platform.windows.natives.SocketImpl
All Implemented Interfaces:
Library, Socket

public class SocketImpl
extends Object
implements Socket


Nested Class Summary
static class SocketImpl.sockaddr_inImpl
           
 
Nested classes/interfaces inherited from interface com.sun.squawk.platform.windows.natives.Socket
Socket.sockaddr_in
 
Field Summary
static int AF_INET
           
static int INADDR_ANY
           
static int INET_ADDRSTRLEN
           
static int SO_ACCEPTCONN
           
static int SO_BROADCAST
           
static int SO_DEBUG
           
static int SO_DONTROUTE
           
static int SO_KEEPALIVE
           
static int SO_OOBINLINE
           
static int SO_REUSEADDR
           
static int SOCK_DGRAM
           
static int SOCK_RAW
           
static int SOCK_STREAM
           
static int SOL_SOCKET
           
 
Fields inherited from interface com.sun.squawk.platform.windows.natives.Socket
INSTANCE
 
Constructor Summary
SocketImpl()
           
 
Method Summary
 int accept(int arg0, Socket.sockaddr_in arg1, IntByReference arg2)
          accept a connection from a client
 int bind(int arg0, Socket.sockaddr_in arg1)
          bind a socket to a port
 int connect(int arg0, Socket.sockaddr_in arg1, int arg2)
          initiate a connection on a socket.
 int getsockopt(int arg0, int arg1, int arg2, ByReference arg3, IntByReference arg4)
          get a socket option
 String inet_ntop(int arg0, IntByReference arg1, Pointer arg2, int arg3)
          Takes an IPv4 Internet address and returns string representing the address in `.' notation
 boolean inet_pton(String arg0, IntByReference arg1)
          Interprets the specified character string as an Internet address, placing the address into the structure provided.
 int initConstInt(int index)
           
 int listen(int arg0, int arg1)
          listen for connections on socket
 int setsockopt(int arg0, int arg1, int arg2, ByReference arg3, int arg4)
          set a socket option
 int shutdown(int arg0, int arg1)
          initiate a connection on a socket.
 int socket(int arg0, int arg1, int arg2)
          socket() creates an endpoint for communication and returns a descriptor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AF_INET

public static final int AF_INET
See Also:
Constant Field Values

SOCK_STREAM

public static final int SOCK_STREAM
See Also:
Constant Field Values

SOCK_DGRAM

public static final int SOCK_DGRAM
See Also:
Constant Field Values

SOCK_RAW

public static final int SOCK_RAW
See Also:
Constant Field Values

INADDR_ANY

public static final int INADDR_ANY
See Also:
Constant Field Values

INET_ADDRSTRLEN

public static final int INET_ADDRSTRLEN
See Also:
Constant Field Values

SOL_SOCKET

public static final int SOL_SOCKET
See Also:
Constant Field Values

SO_DEBUG

public static final int SO_DEBUG
See Also:
Constant Field Values

SO_ACCEPTCONN

public static final int SO_ACCEPTCONN
See Also:
Constant Field Values

SO_REUSEADDR

public static final int SO_REUSEADDR
See Also:
Constant Field Values

SO_KEEPALIVE

public static final int SO_KEEPALIVE
See Also:
Constant Field Values

SO_DONTROUTE

public static final int SO_DONTROUTE
See Also:
Constant Field Values

SO_BROADCAST

public static final int SO_BROADCAST
See Also:
Constant Field Values

SO_OOBINLINE

public static final int SO_OOBINLINE
See Also:
Constant Field Values
Constructor Detail

SocketImpl

public SocketImpl()
Method Detail

initConstInt

public int initConstInt(int index)
Specified by:
initConstInt in interface Library

getsockopt

public int getsockopt(int arg0,
                      int arg1,
                      int arg2,
                      ByReference arg3,
                      IntByReference arg4)
Description copied from interface: Socket
get a socket option

Specified by:
getsockopt in interface Socket
Parameters:
arg0 - socket descriptor
arg4 - On return, the by-reference int will contain the size of the option_value data
Returns:
A -1 is returned if an error occurs, otherwise the return value is a descriptor referencing the socket.

bind

public int bind(int arg0,
                Socket.sockaddr_in arg1)
Description copied from interface: Socket
bind a socket to a port

Specified by:
bind in interface Socket
Parameters:
arg0 - socket descriptor
arg1 - ptr to a SockAddr_In buffer
Returns:
A -1 is returned if an error occurs, otherwise the return value is a descriptor referencing the socket.

listen

public int listen(int arg0,
                  int arg1)
Description copied from interface: Socket
listen for connections on socket

Specified by:
listen in interface Socket
Parameters:
arg0 - socket descriptor
Returns:
A -1 is returned if an error occurs, otherwise the return value is a descriptor referencing the socket.

shutdown

public int shutdown(int arg0,
                    int arg1)
Description copied from interface: Socket
initiate a connection on a socket.

Specified by:
shutdown in interface Socket
Parameters:
arg0 - socket descriptor
arg1 - If how is SHUT_RD, further receives will be disallowed. If how is SHUT_WR, further sends will be disallowed. If how is SHUT_RDWR, further sends and receives will be disallowed.
Returns:
A -1 is returned if an error occurs, otherwise zero is returned

inet_ntop

public String inet_ntop(int arg0,
                        IntByReference arg1,
                        Pointer arg2,
                        int arg3)
Description copied from interface: Socket
Takes an IPv4 Internet address and returns string representing the address in `.' notation

Specified by:
inet_ntop in interface Socket
Parameters:
arg0 - family (should be AF_INET)
arg1 - a pointer to the src internet address
arg2 - a pointer to tmp buffer used to store characters for the result.
arg3 - the size of the tmp dst buffer
Returns:
String (created from the characters in the dst buffer)

socket

public int socket(int arg0,
                  int arg1,
                  int arg2)
Description copied from interface: Socket
socket() creates an endpoint for communication and returns a descriptor.

Specified by:
socket in interface Socket
Parameters:
arg0 - specifies a communications domain within which communication will take place; this selects the protocol family which should be used. The currently understood formats are: AF_UNIX, AF_INET, AF_ISO, AF_NS, AF_IMPLINK
arg1 - specifies the semantics of communication. Currently defined types are: SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, SOCK_SEQPACKET, SOCK_RDM
arg2 - The protocol number to use is particular to the communication domain in which communication is to take place; see protocols(5).
Returns:
A -1 is returned if an error occurs, otherwise the return value is a descriptor referencing the socket.

accept

public int accept(int arg0,
                  Socket.sockaddr_in arg1,
                  IntByReference arg2)
Description copied from interface: Socket
accept a connection from a client

Specified by:
accept in interface Socket
Parameters:
arg0 - socket descriptor
arg1 - ptr to a SockAddr_In buffer that will contain the address of the remote client
arg2 - pointer to int containing the size of an IP address
Returns:
A -1 is returned if an error occurs, otherwise the return value is a descriptor referencing the socket.

connect

public int connect(int arg0,
                   Socket.sockaddr_in arg1,
                   int arg2)
Description copied from interface: Socket
initiate a connection on a socket.

Specified by:
connect in interface Socket
Parameters:
arg0 - socket descriptor
arg1 - ptr to a sockaddr_in buffer
arg2 - pass in sockaddr_in.size()
Returns:
A -1 is returned if an error occurs, otherwise the return value is a descriptor referencing the socket.

setsockopt

public int setsockopt(int arg0,
                      int arg1,
                      int arg2,
                      ByReference arg3,
                      int arg4)
Description copied from interface: Socket
set a socket option

Specified by:
setsockopt in interface Socket
Parameters:
arg0 - socket descriptor
arg4 - (option_value.size()
Returns:
A -1 is returned if an error occurs, otherwise the return value is a descriptor referencing the socket.

inet_pton

public boolean inet_pton(String arg0,
                         IntByReference arg1)
Description copied from interface: Socket
Interprets the specified character string as an Internet address, placing the address into the structure provided. It returns 1 if the string was successfully interpreted, or 0 if the string is invalid

Specified by:
inet_pton in interface Socket
arg1 - (OUT) on sucessful return will contain the 32 bits of an IPv4 "struct in_addr"
Returns:
true if success

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"