|
Need help opening a socket to send data to Classmate running putty.
Attention coding wizards:
My goal is to send diagnostic text to the Classmate to be displayed using putty as a custom/flexible diagnostic display. Here is my code:
import javax.microedition.io.SocketConnection;
import javax.microedition.io.Connector;
import java.io.OutputStream;
import java.io.IOException;
private SocketConnection socket ; // Socket to Classmate
private OutputStream outputStream;
try {
socket = (SocketConnection) Connector.open("telnet://10.36.38.6:23");
socket.setSocketOption(SocketConnection.LINGER, 5);
outputStream = socket.openOutputStream();
System.out.println("Diagnostic socket open.\r\n");
outputStream.write("Goodbye World!\r\n".getBytes());
outputStream.close();
} catch (IOException e) {
System.out.println("Error opening diagnostic socket: " + e.getMessage() + "\r\n");
}
This code gets an error stating "Telnet protocol is not available" (or something similar).
I will try another socket number tonight.
But does anyone have any suggestions how to open a socket or stream to send that to the classmate.
Dan
|