TCP to file

Blitz3D Forums/Blitz3D Programming/TCP to file

blackbag(Posted 2008) [#1]
What I need to do is take an incoming TCP text stream and stick it straight into a text file, its not actually a game applicaiton at all but Blitz is what I am most familar with and I need to eventually process and alter the text before wrting to the file.

I used CreateTCP server to open the port and AcceptTCPStream to start receiving, and some tests indicate this is working ok. But, I get MAV's when the host drops the connection. Any ideas? (use a 'proper' programming language has been considered thanks, but seems like a lot of trouble to learn C or somesuch just for one little thing).

For background, I am attempting to use the internal report scheduler in a phone system to print to a TCP port and write the results to a file than be imported to Access easily.

Below is some test code, output is to screen rather than file.


pbx = createtcpserver (9000)

repeat

delay (100)
pbx_stream = accepttcpstream (pbx)
if pbx_stream then
    print readstring$ (pbx_stream)
end if

until keyhit (1)



Ian.


D4NM4N(Posted 2008) [#2]
.