Here's one quick example:
Code:
// connect to “echo” server:
SocketConnection sc = (SocketConnection) Connector.open("socket://host.com:79");
InputStream is = sc.openInputStream();
OutputStream os = sc.openOutputStream();
os.write("Hello\r\n".getBytes());
int ch = 0;
while(ch != -1) {
ch = is.read();
}
sc.close();