I'm attempting to tackle TCP but I can't seem to determine the problem with my code... the aim is to send a message to the server, and then it should be displayed in the box below the text area (as well as in the other clients.) I'm not sure why my code doesn't accomplish this, so any help would be... well... helpful.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SERVER CODE;;;;;;;;;;;;;;;;;;;;;; AppTitle "SERVER V1.0" dofnetserver=CreateTCPServer(8080) If dofnetserver=0 Print "Server failure..." While Not KeyHit(1) Wend Else Print "Server online..." While Not KeyHit(1) stream=AcceptTCPStream(dofnetserver) If stream<>0 Print "Accepted data..." EndIf Wend EndIf ;;;;;;;;;;;;;;;;;;;;;;;;;;CLIENT CODE;;;;;;;;;;;;;;;;;;;;;;;;;; client=CreateWindow("CLIENT",50,50,640,480) playertext=CreateTextArea(0,ClientHeight(client)/2,400,20,client) submitbutton=CreateButton("Submit",410,ClientHeight(client)/2,100,20,client) chatinfo=CreateCanvas(0,270,ClientWidth(client),96,client) y=0 SetTextAreaText(playertext,"Welcome to this program.") Repeat If WaitEvent()=$803 FreeGadget client Exit EndIf If WaitEvent()=$401 If EventSource()=submitbutton clientstream=OpenTCPStream("127.0.0.1",8080) WriteLine clientstream,TextAreaText$(playertext) SetBuffer CanvasBuffer(chatinfo) Text 0,y,ReadLine$(clientstream) y=y+12 If y>=8*12 y=0 Color 0,0,0 Rect 0,0,400,100,1 Color 255,255,255 EndIf FlipCanvas chatinfo CloseTCPStream clientstream EndIf EndIf Until KeyHit(1)