Jump to content

UDP receive problem


Recommended Posts

Im playing around with UDP and I come across a problem I can seem to figure out.

If I use the following code, I get a msg box that says "Connected" and I receive data from my send command.

$socket = UDPBind("127.0.0.1", 65532)
If @error = 0 Then 
    MsgBox("Connected","Connected","Connected")
While 1
$data = UDPRecv($socket, 50)
If $data <> "" Then
MsgBox(0, "UDP DATA", $data, 1)
EndIf
sleep(100)
WEnd
endif
MsgBox("Not Connected","Not Connected","Not Connected")
sleep(2000)
Exit

If I change "$socket = UDPBind("127.0.0.1", 65532)" to my real ip..lets just say "$socket = UDPBind("195.3.1.192", 65532)" then it will not connect. From what I understand 127.0.0.1 is just an ip of your self, so I dont see why changing that to what my real ip address is, would cause ti not to work anymore.

Link to comment
Share on other sites

Are you running a software firewall that isn't allowing that port?

:whistle:

I think I figured it out. I think the problem is, im a bit confused on what type of file actually needs to be on each computer.

After reading a few other peoples scripts im abit confused on what is suppoed to be happening.

I think I need a script on my side that sends the data and a script on their end to receive the data. Is there a third script a udp server script that I need? And if so, which computer is it supposed to reside on?

Is this correct?

Link to comment
Share on other sites

Ok I got it working.

The problem was

$socket = UDPBind("any ip adress", 65532)

was supposed to be

$socket = UDPBind(@IPAddress1, 65532)

Didnt matter what IP address I used, client or server computer it wouldnt connect.

Link to comment
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
 Share

  • Recently Browsing   0 members

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