Bester

UDPBind problem

17 posts in this topic

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()

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thanks for the reply,

and yes i found that, but somehow that didn`t helped me, since i think my address is valid, because i can send data to that address.

Share this post


Link to post
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) :/

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

So my ip address is 10.3.1.91 and arduino is 10.3.1.94, yet still getting error -1 

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#17 ·  Posted

I'm facing a similar issue. I want to bind to UDP multicast address 239.255.250.250 on port 9131.

I get an error 10049 with `UDPBind("239.255.250.250", 9131)`.

I do not see any option to specify that it is a multicast address. I'm stuck here.

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