Sign in to follow this  
Followers 0
benzrf

TCP errors!

5 posts in this topic

I've been getting really weird results, if not errors, when I try to use the TCP functions. With something like

TCPStartup()
$socket = TCPListen("192.168.1.3", 64432)

MsgBox(0, @error, $socket)
I get a msgbox with the caption "0" and the text "1688". ALWAYS. Even when I pick another port (except for ones that are already in use like 80 (I have an HTTP running)). I don't have any kind of program running that would do that. Unless... My father recently installed WebRoot. That couldn't be it, could it?

Thanks in advance.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

TCPStartup()
$socket = TCPListen(@IPAddress1, 64432)
MsgBox(0, @error, $socket)

The return you are getting is normal. Its the socket identifier. What are you trying to achieve?

Try this, and then open a cmd and "telnet 127.0.0.1 64432" - you'll see it works.

TCPStartup()
$socket = TCPListen("127.0.0.1", 64432)

While True
    $conns =  TCPAccept($socket)
    if $conns >= 0 Then
        MsgBox(0, "Connected", "Connection received")
        exit
    EndIf
WEnd
Edited by Steveiwonder

They call me MrRegExpMan

Share this post


Link to post
Share on other sites

REALLY? In my experience, it keeps returning -1 until someone actually connects.

**shrug**

Ok. I'll try it ty :graduated:

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

TCPListen

Return Value

Success: Returns main socket identifier.

Failure: Returns -1 or 0 and set @error.

@error: 1 IPAddr is incorrect.

2 port is incorrect.

Edited by Steveiwonder

They call me MrRegExpMan

Share this post


Link to post
Share on other sites

In my experience, it keeps returning -1 until someone actually connects.

I believe you're thinking of TCPAccept().

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  
Followers 0