Bester Posted September 16, 2014 Share Posted September 16, 2014 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 More sharing options...
JohnOne Posted September 16, 2014 Share Posted September 16, 2014 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 More sharing options...
j0kky Posted September 16, 2014 Share Posted September 16, 2014 Probably you've set a wrong address with UDPBind Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
Bester Posted September 16, 2014 Author Share Posted September 16, 2014 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. Link to comment Share on other sites More sharing options...
JohnOne Posted September 16, 2014 Share Posted September 16, 2014 I can sent data to any IP address in the world, but they are not IP addresses of my local computer. 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 More sharing options...
Bester Posted September 16, 2014 Author Share Posted September 16, 2014 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 More sharing options...
j0kky Posted September 16, 2014 Share Posted September 16, 2014 Which IP have you setted with UDPBind? Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
JohnOne Posted September 16, 2014 Share Posted September 16, 2014 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 More sharing options...
JohnOne Posted September 16, 2014 Share Posted September 16, 2014 You should probably use the Macro. @IPAddress1 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 More sharing options...
Bester Posted September 16, 2014 Author Share Posted September 16, 2014 So my ip address is 10.3.1.91 and arduino is 10.3.1.94, yet still getting error -1 Link to comment Share on other sites More sharing options...
JohnOne Posted September 16, 2014 Share Posted September 16, 2014 @IPAddress1 gives you 10.3.1.91? 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 More sharing options...
j0kky Posted September 16, 2014 Share Posted September 16, 2014 I've a question: how do you run Autoit executables in Arduino? Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
Bester Posted September 16, 2014 Author Share Posted September 16, 2014 (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 September 16, 2014 by Bester Link to comment Share on other sites More sharing options...
JohnOne Posted September 16, 2014 Share Posted September 16, 2014 I'm not familiar with arduino, but have you looked into the possibility of there being firewall issue? 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 More sharing options...
Bester Posted September 16, 2014 Author Share Posted September 16, 2014 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 More sharing options...
j0kky Posted September 17, 2014 Share Posted September 17, 2014 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. Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
urmilparikh Posted January 7, 2017 Share Posted January 7, 2017 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now