The problem consists in that that, when opening socket the server and client connection implementation with PC. WIP_CEV_OPEN and WIP_CEV_WRITE events are created. A field of it I with PC send data and I see that WIP_CEV_READ event in the processor is created I read wip_read this by means of the command but I receive error state number -999 WIP_CERR_CSTATE. I ask to prompt the possible reasons of such behavior. the part of a code is provided below.
static wip_channel_t socket0S = NULL;
void evh_tcp_server( wip_event_t *ev, void *ctx) {
wip_channel_t c = ev->channel;
int nread = 0;
switch ( ev->kind )
{
case WIP_CEV_OPEN:
adl_atSendResponse ( ADL_AT_UNS,"\r\n Server_WIP_CEV_OPEN");
break;
case WIP_CEV_READ:
{
adl_atSendResponse ( ADL_AT_UNS,"\r\n Server_WIP_CEV_READ");
nread = wip_read ( c, rcv_buffer, sizeof ( rcv_buffer ) );
if(nread > 0) {adl_atSendResponse ( ADL_AT_UNS,"\r\n Read Data from Buf Socket0S"); wm_sprintf_U32_((u32) nread);}
if(nread < 0)
{
adl_atSendResponse ( ADL_AT_UNS,"\r\n Read Data error code Socket0S");
wm_sprintf_U32_((u32) nread);
}
if(nread == 0){adl_atSendResponse ( ADL_AT_UNS,"\r\n Read Data error nread == 0"); wm_sprintf_U32_((u32) nread);}
break;
}
case WIP_CEV_WRITE:
{
adl_atSendResponse ( ADL_AT_UNS,"\r\n Server_WIP_CEV_WRITE");
//nwrite = wip_write ( ev->channel, snd_buffer, sizeof ( snd_buffer ) );
break;
}
case WIP_CEV_ERROR:
{
adl_atSendResponse ( ADL_AT_UNS,"\r\n Server_WIP_CEV_ERROR");
break;
}
case WIP_CEV_PEER_CLOSE:
{
adl_atSendResponse ( ADL_AT_UNS,"\r\n Server_WIP_CEV_PEER_CLOSE");
break;
}
default:
{
adl_atSendResponse ( ADL_AT_UNS,"\r\n Server_WIP_CEV_default");
break;
}
}
}
void appli_tcp_entry_point()
{
socket0S = wip_TCPServerCreate ( (u16)ServerPort, &evh_tcp_server, NULL );
}