Jump to content

Recommended Posts

Posted

server

#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)

FileClose($FO)

$i = $i + 1

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

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

EndIf

Sleep(100)

WEnd

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

TCPStopServer($MainSocket, $ConnectedSocket)

client

#include 'TCP Funcs.au3'

TCPStartup()

$Socket = TCPConnect("10.0.1.199", 7000)

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

TCPCloseSocket($Socket)

TCPShutdown()

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?

  • 2 weeks later...
Posted

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.

Help!

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.

Thanks,

-Jon

AutoIt changed my life.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...