Jump to content

UDPBind problem


Bester
 Share

Recommended Posts

Hello guys,

please excuse my noobness.

I`m trying to communicate with arduino using UDP and i have no problem sending data, but if i try to use UDPBind and UDPRecv to receive data i`m getting error 10049 from UDPBind. 

If anybody could help me out that would be great.

Thanks

Global $udp
Global $sent
Global $recv
Global $new

UDPStartup()

$udp = UDPOpen("10.3.1.94", 8888)
If @error Then ConsoleWrite("udp open error: " & @error & @CRLF)

$sent = UDPSend($udp, "off")
If @error Then ConsoleWrite("udp send error: " & @error & @CRLF)

ConsoleWrite($sent & " bytes sent" & @CRLF)

UDPCloseSocket($udp)


$new = UDPBind("10.3.1.94", 8888)
If @error Then ConsoleWrite("udp bind error: " & @error & @CRLF)

$recv = UDPRecv($new, 1000)

UDPCloseSocket($new)

UDPShutdown()
Link to comment
Share on other sites

10049
Cannot assign requested address.
The requested address is not valid in its context. This normally results from an attempt to bind to an address that is not valid for the local computer. This can also result from connect, sendto, WSAConnect, WSAJoinLeaf, or WSASendTo when the remote address or port is not valid for a remote computer (for example, address or port 0).

 

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Oh, so the ip address in the UDPBind is suppose to be my and not the device i`m trying to listen to? Wasn`t clear in the help file so i thought it`s gonna be same as for UDPOpen. Well thank you for the help, but now i`m getting error -1 from UDPRecv (invalid socketarray) :/

Link to comment
Share on other sites

Oh, so the ip address in the UDPBind is suppose to be my and not the device i`m trying to listen to? Wasn`t clear in the help file so i thought it`s gonna be same as for UDPOpen. Well thank you for the help, but now i`m getting error -1 from UDPRecv (invalid socketarray) :/

Yes, I suppose the help file could mention the valid address must be local.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

yes, my ip is 10.3.1.91, my home subnet is 10.3.1.0/24, also i`m not running autoit on arduino, i`m trying to send data to arduino via UDP using autoit, and i can already do that, i just can`t receive data from arduino 

Edited by Bester
Link to comment
Share on other sites

Yes i have, autoit has all rights to access the network, i think i just messed up something in my code, since i`m getting 'invalid socketarray' error from UDPRecv.
Also thank you guys so much for helping me out here. Much appreciated.

Link to comment
Share on other sites

Try to create the server modifying this paramenter couple (IP-Port) of UDPBind:

@IPAddress1 - 8888

@IPAddress1 - 65432

127.0.0.1 - 8888

127.0.0.1 - 65432

And report the various errors for each couple.

Link to comment
Share on other sites

  • 2 years later...

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