Other Parts Discussed in Thread: CC3120
Hello sir,
I use the cc3120 module to do development, based on the network_terminal routine. In the routine tcp client send and receive are used to local variables defined socket. The examples are:
int32_t TCPClient(uint8_t nb, uint16_t portNumber, ip_t ipAddress, uint8_t ipv6, uint32_t numberOfPackets, uint8_t tx)
{
int32_t sock;
********
if(tx)
{
buflen = MAX_BUF_SIZE;
/* Send packets to the server */
status = sl_Send(sock, &buf, buflen, 0);
********
}
else
{
*******
status = sl_Recv(sock, &buf, buflen, 0);
********
}
}
If I want to use the same socket to do tcp receive and send at the same time, is this feasible?
For example, define a global variable int32_t gSock, and then call sl_Send (gSock, *, *, *) to send data in one thread and sl_Recv (gSock, *, *, *) to receive data in another thread. These two threads use the same socket variable.
If this is not feasible, what is the reason? And how can I be able to achieve the target that use one tcp connection to asynchronous parallel send and receive messages?
thank you!