Jump to content
Sign in to follow this  

simple networking - server that saves strings

Recommended Posts



#include <Misc.au3>

#include 'TCP Funcs.au3'

Local $ConnectedSocket = -1

$MainSocket = TCPStartServer(7000)

$i = 13

MsgBox(0, "Message Received", "it started")

While 1;_IsPressed('1B') = 0

If $ConnectedSocket = -1 Then $ConnectedSocket = TCPAllowConnection($MainSocket)

$Data = TCPReceive($ConnectedSocket)

If @Error = 0 Then

$name = "file"

$FO = FileOpen(@ScriptDir & "\" & $name & $i & ".txt", 1)

FileWrite($FO, $Data & $i)


$i = $i + 1

MsgBox(0, "Message Received", $i)

MsgBox(0, "Message Received", $Data)




MsgBox(0, "Message Received", "server has stopped")

TCPStopServer($MainSocket, $ConnectedSocket)


#include 'TCP Funcs.au3'


$Socket = TCPConnect("", 7000)

TCPSendMessage($Socket, "This is a test!")



however, it would only receive the send once, pop the boxes, save the file, yet not being able to receive another client send

why is that?

Share this post

Link to post
Share on other sites

I have nearly the same question.

I have a Client application that generates a string of data and writes it to an ini I have a server application that reads from an ini and inputs that data into an AS400 system. What I need is a way to get the data strings from the ini on the client and to the server. Currently I'm having a person at the client side e-mail this and I copy it to the ini. I'm having a real hard time creating a client/server that can transmit this data more then one time reliably. I can (using code very similar to that above) send the data string from one to the other however for whatever reason it only works on time and can not reconnect without restarting the client and server both.


Simply put I need a reliable client side that sends a data string to the server then disconnects and can do that again without restarting the server.



AutoIt changed my life.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this