Quote:
Originally Posted by yash101
I am using a library to make socket programming extremely easy. However, the easiest to implement protocol that it supports is TCP. Also, I want a constant bi-directional data transfer. I basically want to have some request system, where the cRIO can request some data from the coprocessor, and vice-versa. This would also allow me to use the same socket server to send data to a UI, etc.
UDP is my last choice. For some basic path-planning, I will need to ensure that all the requests complete in a structured order!
I guess that if I can implement NetworkTables on the coprocessor, that would make things extremely simple! However, I don't think NetTables were built to be as portable as I want them to be! 
|
What dont you understand about the Packet class?
write data to the PacketOutputStream and send it to the server..
found this in the SocketConnection class (which seems to be the well documented class around packets and sockets)
Code:
SocketConnection sc = (SocketConnection)
Connector.open("socket://host.com:79");
sc.setSocketOption(SocketConnection.LINGER, 5);
InputStream is = sc.openInputStream(); OutputStream os =
sc.openOutputStream();
os.write("\r\n".getBytes()); int ch = 0; while(ch != -1) { ch = is.read(); }
is.close(); os.close(); sc.close();