public class Socket extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Socket.StopListening
This interface can be invoked to stop listening on a server socket
|
Modifier and Type | Method and Description |
---|---|
static void |
connect(String host,
int port,
SocketConnection sc)
Connect to a remote host
|
static com.codename1.io.Socket.Close |
connectWithClose(String host,
int port,
SocketConnection sc)
Connect to a remote host
|
static String |
getHostOrIP()
Returns the hostname or ip address of the device if available/applicable
|
static boolean |
isServerSocketSupported()
Deprecated.
server sockets are only supported on Android and Desktop and as such
we recommend against using them
|
static boolean |
isSupported()
Returns true if sockets are supported in this port, false otherwise
|
static Socket.StopListening |
listen(int port,
Class scClass)
Deprecated.
server sockets are only supported on Android and Desktop and as such
we recommend against using them
|
public static boolean isSupported()
public static boolean isServerSocketSupported()
public static void connect(String host, int port, SocketConnection sc)
host
- the hostport
- the connection portsc
- callback for when the connection is established or failspublic static com.codename1.io.Socket.Close connectWithClose(String host, int port, SocketConnection sc)
host
- the hostport
- the connection portsc
- callback for when the connection is established or failspublic static Socket.StopListening listen(int port, Class scClass)
port
- the device portscClass
- 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.public static String getHostOrIP()