"

2013 FRC Java API

"

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

java.lang.Object
  extended by com.sun.squawk.platform.posix.natives.SocketImpl
All Implemented Interfaces:
Library, Socket
Direct Known Subclasses:
SocketImpl, SocketImpl, SocketImpl, SocketImpl

public abstract class SocketImpl
extends Object
implements Socket


Nested Class Summary
static class SocketImpl.sockaddr_inImpl
           
 
Nested classes/interfaces inherited from interface com.sun.squawk.platform.posix.natives.Socket
Socket.sockaddr_in
 
Field Summary
 
Fields inherited from interface com.sun.squawk.platform.posix.natives.Socket
AF_INET, INADDR_ANY, INET_ADDRSTRLEN, INSTANCE, IPPROTO_TCP, SO_ACCEPTCONN, SO_BROADCAST, SO_DEBUG, SO_DONTROUTE, SO_ERROR, SO_KEEPALIVE, SO_OOBINLINE, SO_RCVBUF, SO_RCVLOWAT, SO_RCVTIMEO, SO_REUSEADDR, SO_SNDBUF, SO_SNDLOWAT, SO_SNDTIMEO, SO_TYPE, SOCK_DGRAM, SOCK_RAW, SOCK_STREAM, SOL_SOCKET, TCP_NODELAY
 
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, int arg2)
          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 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
 
Methods inherited from interface com.sun.cldc.jna.Library
initConstInt
 

Constructor Detail

SocketImpl

public SocketImpl()
Method Detail

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,
                int arg2)
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
arg2 - size of sockaddr_in
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
"