Working on an app here and I wanna send files between the client and a server. The files will be anything from text files to media files. I found the following but it's to slow to use anyone have any ideas on how to speed this up? I dont wanna use ETNA so please dont suggest it :)
Client
Server
Code was posted by tonyg.
Client
mysocket:TSocket = CreateTCPSocket() mysocketstream=CreateSocketStream(mysocket) ConnectSocket(mysocket,HostIp("localhost"),8080) mystream:TStream=ReadStream("max1.bmp") CopyStream(mystream,mysocketstream) CloseStream mystream CloseStream mysocketstream CloseSocket mysocket Print "done"
Server
mysocket:TSocket=CreateTCPSocket() BindSocket(mysocket,8080) SocketListen(mysocket) Repeat myreadsocket:TSocket=SocketAccept(mysocket) If myreadsocket myreadsocketstream=CreateSocketStream(myreadsocket) mystream:TStream=WriteStream("test_out.bmp") CopyStream(myreadsocketstream,mystream) read=True EndIf Until read=True CloseStream(mystream) CloseStream(myreadsocketstream) CloseSocket(myreadsocket) CloseSocket(mysocket) Print "Done"
Code was posted by tonyg.