Class Socket
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThis interface can be invoked to stop listening on a server socket -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconnect(String host, int port, SocketConnection sc) Connect to a remote hoststatic com.codename1.io.Socket.CloseconnectWithClose(String host, int port, SocketConnection sc) Connect to a remote hoststatic StringReturns the hostname or ip address of the device if available/applicablestatic booleanReturns true if server sockets are supported in this port, if this method returns false invocations of listen will always failstatic booleanReturns true if sockets are supported in this port, false otherwisestatic Socket.StopListeningListen to incoming connections on port
-
Method Details
-
isSupported
public static boolean isSupported()Returns true if sockets are supported in this port, false otherwise
Returns
true if sockets are supported in this port, false otherwise
-
isServerSocketSupported
public static boolean isServerSocketSupported()Returns true if server sockets are supported in this port, if this method returns false invocations of listen will always fail
Returns
true if server sockets are supported in this port, false otherwise
Deprecated
-
connect
Connect to a remote host
Parameters
-
host: the host -
port: the connection port -
sc: callback for when the connection is established or fails
-
-
connectWithClose
public static com.codename1.io.Socket.Close connectWithClose(String host, int port, SocketConnection sc) Connect to a remote host
Parameters
-
host: the host -
port: the connection port -
sc: callback for when the connection is established or fails
-
-
listen
Listen to incoming connections on port
Parameters
-
port: the device port -
scClass: @param scClass class of callback for when the connection is established or fails, this class will be instantiated for every incoming connection and must have a public no argument constructor.
Returns
StopListening instance that allows the the caller to stop listening on a server socket
Deprecated
-
-
getHostOrIP
Returns the hostname or ip address of the device if available/applicable
Returns
the hostname or ip address of the device if available/applicable
-