Jump to content

Recommended Posts

Posted

Hello all,

I'm using AutoIt to create a small Network application, based on TCP.

I created a server and a client code, the server uses TCPListen("",65432,100) to accept connections.

The Client uses TCPConnect("Ip-Address",65432) to connect to the server.

Well, everything works fine if i try it on Windows XP. It also works if I start the server on a Windows XP Machine and connect from a Windows 7 pc.

But I run into problems when I start the server on the Windows 7 pc and try to connect from XP. When Using the TCPConnect() command it always returns -1.

I've disabled the firewall, run as administrator, but it doesn't seems to work for me. I also tried to disable the ip-v6 protocol on the Windows 7 machine, but still I don't get any connection.

I also tried to compile the script with the latest Autoit Beta (3.3.1.5) - same error.

I hope that someone can give me a hint.

Thanks for any suggestions!

Posted

Thanks for your fast answer!

No, I also can't get any connection if i try to connect to "127.0.0.1" on the Windows 7 machine. It also returns -1 at TCPConnect()

Regards

TSGames

Posted

That's interesting. Have you tried a different port number to see if that's the problem?

Like just try this pair of scripts.

TCPStartup()
$socket = TCPListen("", 12345, 10)
While True
    $newsocket = TCPAccept($socket)
    If $newsocket != -1 Then
        MsgBox(0, "Connected", "Connected")
        Exit
    EndIf
    Sleep(100)
WEnd

TCPStartup()
$socket = TCPConnect("", 12345)
MsgBox(0, "", "Socket = " & $socket)
Posted (edited)

Well, now I found out something interesting.

If i create a Socket to Listen on the Windows 7 machine as in your example

TCPListen("",12345,10)

it returns -1 and sets @error to 1

(On the windows xp machine it returns an id and no error).

So, if I enter an ip which is allowed to connect to, as 127.0.0.1, it returns an id and succeed.

If I now connect using TCPConnect("127.0.0.1",12345) it works fine, but only if I actually connect from this ip.

For example, if I call TCPConnect with the own LAN-IP, it doesn't work

But how can I get it work to connect regardless of the client's ip?

[EDIT] TCPListen(0,12345,10) seems to work. May should be documented in future versions?

Thanks

TSGames

Edited by TSGames

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...