Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 3 months ago.
socket not available for use
Hello,
Getting error socket not available for use or Error -3005 from Networking Errors list when trying to bind port for receiving data from it. Using NucleoF767ZI and UDP Socket
Does anybody nows what does it mean?
Regards, Daniel
2 Answers
7 years, 3 months ago.
This is a good resource - https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/communication/network_sockets/.
What type of connectivity are you using? Is there only one socket open? If there is more than one, it might be that you have used the maximum amount allowed in this driver.
Thank you Sarah for reply,
1.Can you explain what you meant by type of connectivity? Ethernet I guess . Sending UDP messages from first NucleoF767 to second NucleoF767.
2.One socket for receiving and another for sending, but sending is working. What is limit?
3.Problem is in socket configuration I think. I am trying to receive UDP messages from broadcast IP and bind to specific port.
CODE EXAMPLE: const int PORT = 1234; example
EthernetInterface eth;
Thread thread;
void Receive(){ UDPSocket sock; SocketAddres addr;
sock.open(ð); sock.bind(port)
char buffer[256];
while(1){ recvfrom(&addr ,buffer, sizeof(buffer)); } }
int main(){
thread.start(Receive); }
Result: getting -3003 error(invalid configuration) on opening socket or -3004(not connected to a network) on binding to port functions.
Daniel
posted by 21 Sep 2017Are both boards connected by ethernet to the same network? In your example, you have not connected the board to the network.
eth.connect() would accomplish that.
posted by 22 Sep 20176 years, 9 months ago.
I think you are suppose to call init() of EthernetInterface ..which getIp from DHCP.....
If somebody knows documentation about UDP socket or threads with more details( have checked mbed Documentation already) please share.
posted by Daniel Klioc 21 Sep 2017