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 portMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
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
-