I'm making a program that uses TCP streams. I'm making the server program right now. I know how to send a message to the sever from the client program, but what I'm not so sure of is how to send a message to the client. This is how I'm doing the server:
I'm doing all this based off what I read in the help section for the TCP commands. If the client wanted to send me a message after they have connected to the server, they would use:
; write stream to server
WriteString strmGame,"Mission Control, this is Apollo X ..."
As from the help section. How would I send a message to the client? Would this work?:
WriteString(hServer,"Hello")
How do I do it?
Also, I seems like I just treat TCP streams just like I would a file. So in that case, I could write a lot of data into a stream and then on the client side I could read it just like a regular file?
hServer=CreateTCPServer(6791) If hServer=0 RuntimeError "Failed to create server." EndIf hConWnd=CreateWindow("Connecting...",(1024-240)/2,(768-(60+29))/2,240,60+29,hMainWnd,1) CreateLabel("Connecting...",80,20,70,20,hConWnd) While 1 TCPStream=AcceptTCPStream(hServer) If TCPStream If ReadString(TCPStream)="59872594" Exit EndIf EndIf Wend
I'm doing all this based off what I read in the help section for the TCP commands. If the client wanted to send me a message after they have connected to the server, they would use:
; write stream to server
WriteString strmGame,"Mission Control, this is Apollo X ..."
As from the help section. How would I send a message to the client? Would this work?:
WriteString(hServer,"Hello")
How do I do it?
Also, I seems like I just treat TCP streams just like I would a file. So in that case, I could write a lot of data into a stream and then on the client side I could read it just like a regular file?