The bind() doesn't work ,when I try to bind it to 0.0.0.0 or any unicast Ip for that matter and returns a value of -1
Though , it works perfectly fine and Rx happens properly with a multicast address.
Can anyone help me in this regard ??
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
The bind() doesn't work ,when I try to bind it to 0.0.0.0 or any unicast Ip for that matter and returns a value of -1
Though , it works perfectly fine and Rx happens properly with a multicast address.
Can anyone help me in this regard ??
Hi Vipul,
What is the patch version you are using?
Please refer the CC3000 Basic Wi-Fi example application and letme know if it helps:
http://processors.wiki.ti.com/index.php/CC3000_Basic_Wi-Fi_example_application_for_MSP430
Regards,
Abhijit
Hi Kumar,
Bind is used in the sensor app, which uses the allocated IP address to bind. Here is the code that does it:
int port = SERVER_PORT;
erverSocketAddr.sa_family = AF_INET;
// Set the Port Number
serverSocketAddr.sa_data[0] = (port & 0xFF00)>> 8;
serverSocketAddr.sa_data[1] = (port & 0x00FF);
memset (&serverSocketAddr.sa_data[2], 0, 4);
if (bind(serverSocket, &serverSocketAddr, sizeof(sockaddr)) != 0)
BR,
Pedro
Abhijit ,
I used nvmem_read_sp_version() to check , I got the value to be 1.7 .So that means i am using the lastest patch program , right ??
Pedro ,
I have tried using your suggestions but with no result untill now.
Does CC3000 support "bind" and/or "connect" to a unicast address , in case of UDP ??
Vipul
Pedro ,
I can now bind using your suggestion but recvfrom( ) hangs indefinetly and doesn't return a value.
Regards,
Vipul
Hi Kumar,
Are you using the MSP430? Which function is it hanging? What is the size of your RX buffer?
Could you try setting the received timeout to a few milliseconds, for example 200:
unsigned long timeout = 200; //milliseconds
setsockopt( sd, SOL_SOCKET, SOCKOPT_RECV_TIMEOUT, &timeout, sizeof( timeout ) );
Pedro
Hi Pedro ,
Yes i am using the MSP430FR5739 experimenter board.
RX buffer size is 10 as i am using an android app to send UDP data of 10 bytes.
This works fine when I transmit the data using my app to 224.0.0.1 and i can see all the packets correctly
but i cannot receive anything when i try to bind my socket to 0.0.0.0 and recvfrom() hangs .
I will try your suggestion on timeout but isn't the default timeout also small enough ??
Hence the question , can CC3000 receive and send data using a unicast address or not ??
Regrads,
Vipul
Hi Kumar,
Yes it can receive and send data using the unicast address, I have tried multiple time. Does the receive also hangs if you are only receiving, or when it switches from sending to receiving, if this is the case could you try adding some delay between the send and the receive.
Pedro
Hi Pedro ,
The receive hangs when i use a unicast address on UDP to recieve.I have been able to use multicast and receive and send properly.
But in the case of unicast address RX and TX just don't happen.Do i need to use a server application to use unicast RX and TX ??
Vipul