How can i send a strin using getOutputStream method. It can only send byte as they mentioned. So far I can send a byte. but not a string value.
public void sendToPort() throws IOException {
Socket socket = null;
try {
socket = new Socket("ip address", 4014);
socket.getOutputStream().write(2); // have to insert the string
} catch (UnknownHostException e) {
System.err.print(e);
} finally {
socket.close();
}
}
Thanks in advance