I think that I am missing something.
First of all let me use the standard excuse that I am new into this.
At the moment I am trying to set up a bind() within Digi ME. But my bind function always gives me always a minus 1 as result.
I made successful a socket, that was not hard and listening from it is also not a problem. But bind is strange to me.
The help file writes that I should use “Pointer to a sockaddr structure that stores the attributes to be bound to the socket endpoint address of the connected socket.”
Okay, and I should use INADDR_ANY to avoid static IP addresses. Assuming that I should set this IP-address in the sock settings, called a sock structure.
When I look at the sockaddr struct, the confusion starts.
The building stones of the struct.
sa_len Total Length
sa_family Address Family AF_xxx
sa_data Protocol specific address
Total Length? Would be nice when known which length I should use.
AF_xxx is crystal clear, I should pick IPv4 or IPv6. That is well documented.
Then sa_data… It is char[], how can I place an value of INADDR_ANY in here?
While using the union from sock_addr with only the family en port set, I have no problems at all.
There must be something I am doing wrong, but what…