Unhandled Exception: SocketException: Failed to create datagram socket (OS Error: Can't assign requested address, errno = 49), address = 255.255.255.255, port = 1050

I am using RawDatagramSocket.bind(InternetAddress('255.255.255.255'), 1050) in Flutter also added local network access permission with a description but still getting this error

Unhandled Exception: SocketException: Failed to create datagram socket (OS Error: Can't assign requested address, errno = 49), address = 255.255.255.255, port = 1050

It’s hard to offer advice without more info. What platform is this on? What version? And so on. See Quinn’s Top Ten DevForums Tips for more details.

Also, you wrote:

I am using … in Flutter

I can’t help you with third-party libraries. My advice is that you dig into the library to work out what Apple API it’s using under the covers.

Finally, working with UDP is a challenge. To offer the best advice I need to know something about the protocol you’re trying to implement. What do you want this to look like on the ‘wire’?

Specifically, a UDP datagram is characterised by a tuple of remote address, remote port, local address, and local port. So:

  • What is the tuple of the datagrams you’re trying to send?

  • And receive?

  • And roughly how does this conversation work? Any you interacting with multiple peers? If so, who initiates the conversation? And is there some sort of request / response thing going on?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Unhandled Exception: SocketException: Failed to create datagram socket (OS Error: Can't assign requested address, errno = 49), address = 255.255.255.255, port = 1050
 
 
Q