Jump to content
Sign in to follow this  
pyzonet

[SOLVED] How to send text/string to computer server?

Recommended Posts

pyzonet

I use this but not working:

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $ConnectedSocket, $szData
    Local $szIPADDRESS = @IPAddress1
    Local $nPORT = 33891

    TCPStartup()

    $ConnectedSocket = -1

    $ConnectedSocket = TCPConnect($szIPADDRESS, $nPORT)

    If @error Then
        MsgBox(4112, "Error", "TCPConnect failed with WSA error: " & @error)
    Else
        While 1
            $szData = InputBox("Data for Server", @LF & @LF & "Enter data to transmit to the SERVER:")

            If @error Or $szData = "" Then ExitLoop

            TCPSend($ConnectedSocket, $szData)

            If @error Then ExitLoop
        WEnd
    EndIf
EndFunc
Edited by pyzonet

Example Script(s): Export Listview to Excel & Print!....(¯`v´¯)..... ·.¸.·´...¸.·´.. (☻//▌♥♥/ \ ... Wake up the dawn and ask her why ...╔══╗ ♥ ♫ ♥║██║ ♫ ♥ ♫║(O)║♥A dreamer dreams she never dies♥╚══╝۩۞۩ஜ1984'09ஜ۩۞۩

Share this post


Link to post
Share on other sites
LurchMan

Do you have the TCP/IP Server running on the Server that is suppose to receive the message?


Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites
Mat

You can test it by running a second script called Server.au3 that uses TCPListen and then TCPRecv. Look at the example in the helpfile for the latter for a pretty good example :x

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.