I have a server running that runs on TCP/IP. It reads strings and responds with strings. I just wondered if I can just connect via Flash to my server and get some answers from it. My second idea was:
var socket: Socket = new Socket("192.168.0.100", 4847);
socket.writeObject("hello");
var answer: String = socket.readObject();
trace(answer);
Connection is established successfully. But I'm not sure how I send and receive strings now.
Update:
socket.writeUTFBytes("hello\r\n");
seems to work for sending- how to read ?
socket.readUTF()
?- I don't know how long the answer might be, it can be short or very long
- how about end of line ? It is important for my server since that's how messages are separated. Do I have to send eol via
"\r\n"
? - Update 2: This seems to work well