Winsock problem in pocket PC 
Author Message
 Winsock problem in pocket PC

Hi,

I wrote a small application which will connect to http server and get
the html pages in PPC and PPC 2002.

The winsock recv() function always gives WSAECONNRESET(10054) error. and
the. I don't know where iam going wrong. The whole code is taken from
msdn. I have copied the code that iam using here. This happens in PPC
2002. Iam using Cassiopeia E2000

In PPC iam able to receive the data for the first time it executes the
recv() function and if the buffer size is small for the data received,
it returns 0 for the 2 retry. Iam using Toshiba Genio E.

What should i do to read the data fully with small buffer. Right now i
have a buffer size of 2048. But i want to use a small buffer and save
the it in the file.

Could some one help me out please.

Thanks,
Nanda Kumar G.

#define BUFFSIZE 2048

int socketTest(char *gHostName, char *gPath){
        int index = 0, iReturn ;
        unsigned long totalsize;
        char szClientA[BUFFSIZE];
        wchar_t szClientW[BUFFSIZE];
        SOCKET ServerSock = INVALID_SOCKET;
        SOCKADDR_IN destination_sin;
        PHOSTENT phostent = NULL;
        WSADATA WSAData;
        if (WSAStartup (MAKEWORD(1,1), &WSAData) != 0){
                wsprintf (szError, TEXT("WSAStartup failed. Error: %d"),
                                  WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
                return ERROR;
        }
        if ((ServerSock = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET){
                wsprintf (szError, TEXT("Allocating socket failed. Error: %d"),
                                  WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
                return ERROR;
        }
        destination_sin.sin_family = AF_INET;

        if ((phostent = gethostbyname (gHostName)) == NULL){
                wsprintf (szError, TEXT("Unable to get the host name. Error: %d"),
                                  WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
                closesocket (ServerSock);
                return ERROR;
        }

        memcpy ((char FAR *)&(destination_sin.sin_addr),
                  phostent->h_addr,
                  phostent->h_length);

        destination_sin.sin_port = htons (80);

        sprintf(gArr,"GET %s HTTP/1.0",gPath);
        if (connect (ServerSock,
                           (PSOCKADDR) &destination_sin,
                           sizeof (destination_sin)) == SOCKET_ERROR){

                wsprintf (szError,
                                TEXT("Connecting to the server failed. Error: %d"),
                                WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
                closesocket (ServerSock);
                return ERROR;
        }

        if (send (ServerSock, gArr, strlen(gArr), 0) == SOCKET_ERROR) {
                wsprintf (szError, TEXT("Sending data to the server failed. Error: %d"),
                        WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
        }

        shutdown (ServerSock, 0x01);

        for (;;){
                memset(szClientA,'\0',BUFFSIZE);                
                iReturn = recv (ServerSock, szClientA, BUFFSIZE, 0);

                if (iReturn == SOCKET_ERROR){
                        wsprintf (szError, TEXT("No data is received, recv failed Error: %d"),
WSAGetLastError ());
                        MessageBox (NULL, szError, TEXT("Client"), MB_OK);
                        break;
                } else if (iReturn == 0) {
                        MessageBox (NULL, TEXT("Finished receiving data"), TEXT("Client"),MB_OK);
                        break;
                }  else {
                        if(gfd != NULL){
                                fwrite( szClientA, sizeof( char ), iReturn,gfd );
                        }
                        totalsize += iReturn;
                }
        }
        swprintf(szClientW,TEXT("Total length %d "),totalsize);
        MessageBox (NULL, szClientW, TEXT("Length RECV"), MB_OK);

        shutdown (ServerSock, 0x00);

        closesocket (ServerSock);

        WSACleanup ();

        return totalsize;

Quote:
}



Tue, 11 Jan 2005 21:10:59 GMT  
 Winsock problem in pocket PC
I don't think we have enough information to answer, but it's likely that the
request that you sent to the server was invalid, so it closed the connection
on you.

Paul T.



Quote:
> Hi,

> I wrote a small application which will connect to http server and get
> the html pages in PPC and PPC 2002.

> The winsock recv() function always gives WSAECONNRESET(10054) error. and
> the. I don't know where iam going wrong. The whole code is taken from
> msdn. I have copied the code that iam using here. This happens in PPC
> 2002. Iam using Cassiopeia E2000

> In PPC iam able to receive the data for the first time it executes the
> recv() function and if the buffer size is small for the data received,
> it returns 0 for the 2 retry. Iam using Toshiba Genio E.

> What should i do to read the data fully with small buffer. Right now i
> have a buffer size of 2048. But i want to use a small buffer and save
> the it in the file.

> Could some one help me out please.

> Thanks,
> Nanda Kumar G.

> #define BUFFSIZE 2048

> int socketTest(char *gHostName, char *gPath){
> int index = 0, iReturn ;
> unsigned long totalsize;
> char szClientA[BUFFSIZE];
> wchar_t szClientW[BUFFSIZE];
> SOCKET ServerSock = INVALID_SOCKET;
> SOCKADDR_IN destination_sin;
> PHOSTENT phostent = NULL;
> WSADATA WSAData;
> if (WSAStartup (MAKEWORD(1,1), &WSAData) != 0){
> wsprintf (szError, TEXT("WSAStartup failed. Error: %d"),
>   WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> return ERROR;
> }
> if ((ServerSock = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET){
> wsprintf (szError, TEXT("Allocating socket failed. Error: %d"),
>   WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> return ERROR;
> }
> destination_sin.sin_family = AF_INET;

> if ((phostent = gethostbyname (gHostName)) == NULL){
> wsprintf (szError, TEXT("Unable to get the host name. Error: %d"),
>   WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> closesocket (ServerSock);
> return ERROR;
> }

> memcpy ((char FAR *)&(destination_sin.sin_addr),
>   phostent->h_addr,
>   phostent->h_length);

> destination_sin.sin_port = htons (80);

> sprintf(gArr,"GET %s HTTP/1.0",gPath);
> if (connect (ServerSock,
>    (PSOCKADDR) &destination_sin,
>    sizeof (destination_sin)) == SOCKET_ERROR){

> wsprintf (szError,
> TEXT("Connecting to the server failed. Error: %d"),
> WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> closesocket (ServerSock);
> return ERROR;
> }

> if (send (ServerSock, gArr, strlen(gArr), 0) == SOCKET_ERROR) {
> wsprintf (szError, TEXT("Sending data to the server failed. Error: %d"),
> WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> }

> shutdown (ServerSock, 0x01);

> for (;;){
> memset(szClientA,'\0',BUFFSIZE);
> iReturn = recv (ServerSock, szClientA, BUFFSIZE, 0);

> if (iReturn == SOCKET_ERROR){
> wsprintf (szError, TEXT("No data is received, recv failed Error: %d"),
> WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Client"), MB_OK);
> break;
> } else if (iReturn == 0) {
> MessageBox (NULL, TEXT("Finished receiving data"), TEXT("Client"),MB_OK);
> break;
> }  else {
> if(gfd != NULL){
> fwrite( szClientA, sizeof( char ), iReturn,gfd );
> }
> totalsize += iReturn;
> }
> }
> swprintf(szClientW,TEXT("Total length %d "),totalsize);
> MessageBox (NULL, szClientW, TEXT("Length RECV"), MB_OK);

> shutdown (ServerSock, 0x00);

> closesocket (ServerSock);

> WSACleanup ();

> return totalsize;
> }



Tue, 11 Jan 2005 23:18:38 GMT  
 Winsock problem in pocket PC
Thanks for your response,

Server is getting proper request. The servers request log is ok and the
servers respose is also ok. the same code and the request is working
fine with Genio and iam geting the html page also, but with cassiopia
only iam facing this problem. Do i need to do something specific for
pocket pc 2002.

Thanks,
Nanda Kuamar G.

Quote:

> I don't think we have enough information to answer, but it's likely that the
> request that you sent to the server was invalid, so it closed the connection
> on you.

> Paul T.



Fri, 14 Jan 2005 09:10:42 GMT  
 Winsock problem in pocket PC
Hi,

My http request is,

GET /index.html HTTP/1.0\r\n
User-Agent: MyBrowser\r\n
Accept: */*\r\n

Thanks,
Nanda Kumar G.



Fri, 14 Jan 2005 21:17:40 GMT  
 Winsock problem in pocket PC
And *all* you are doing is send( socket, <the message shown> ), and recv(
socket, &somebuffer ), both in the same thread, and recv is getting a
connection reset indication?

Paul T.



Quote:
> Hi,

> I wrote a small application which will connect to http server and get
> the html pages in PPC and PPC 2002.

> The winsock recv() function always gives WSAECONNRESET(10054) error. and
> the. I don't know where iam going wrong. The whole code is taken from
> msdn. I have copied the code that iam using here. This happens in PPC
> 2002. Iam using Cassiopeia E2000

> In PPC iam able to receive the data for the first time it executes the
> recv() function and if the buffer size is small for the data received,
> it returns 0 for the 2 retry. Iam using Toshiba Genio E.

> What should i do to read the data fully with small buffer. Right now i
> have a buffer size of 2048. But i want to use a small buffer and save
> the it in the file.

> Could some one help me out please.

> Thanks,
> Nanda Kumar G.

> #define BUFFSIZE 2048

> int socketTest(char *gHostName, char *gPath){
> int index = 0, iReturn ;
> unsigned long totalsize;
> char szClientA[BUFFSIZE];
> wchar_t szClientW[BUFFSIZE];
> SOCKET ServerSock = INVALID_SOCKET;
> SOCKADDR_IN destination_sin;
> PHOSTENT phostent = NULL;
> WSADATA WSAData;
> if (WSAStartup (MAKEWORD(1,1), &WSAData) != 0){
> wsprintf (szError, TEXT("WSAStartup failed. Error: %d"),
>   WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> return ERROR;
> }
> if ((ServerSock = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET){
> wsprintf (szError, TEXT("Allocating socket failed. Error: %d"),
>   WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> return ERROR;
> }
> destination_sin.sin_family = AF_INET;

> if ((phostent = gethostbyname (gHostName)) == NULL){
> wsprintf (szError, TEXT("Unable to get the host name. Error: %d"),
>   WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> closesocket (ServerSock);
> return ERROR;
> }

> memcpy ((char FAR *)&(destination_sin.sin_addr),
>   phostent->h_addr,
>   phostent->h_length);

> destination_sin.sin_port = htons (80);

> sprintf(gArr,"GET %s HTTP/1.0",gPath);
> if (connect (ServerSock,
>    (PSOCKADDR) &destination_sin,
>    sizeof (destination_sin)) == SOCKET_ERROR){

> wsprintf (szError,
> TEXT("Connecting to the server failed. Error: %d"),
> WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> closesocket (ServerSock);
> return ERROR;
> }

> if (send (ServerSock, gArr, strlen(gArr), 0) == SOCKET_ERROR) {
> wsprintf (szError, TEXT("Sending data to the server failed. Error: %d"),
> WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> }

> shutdown (ServerSock, 0x01);

> for (;;){
> memset(szClientA,'\0',BUFFSIZE);
> iReturn = recv (ServerSock, szClientA, BUFFSIZE, 0);

> if (iReturn == SOCKET_ERROR){
> wsprintf (szError, TEXT("No data is received, recv failed Error: %d"),
> WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Client"), MB_OK);
> break;
> } else if (iReturn == 0) {
> MessageBox (NULL, TEXT("Finished receiving data"), TEXT("Client"),MB_OK);
> break;
> }  else {
> if(gfd != NULL){
> fwrite( szClientA, sizeof( char ), iReturn,gfd );
> }
> totalsize += iReturn;
> }
> }
> swprintf(szClientW,TEXT("Total length %d "),totalsize);
> MessageBox (NULL, szClientW, TEXT("Length RECV"), MB_OK);

> shutdown (ServerSock, 0x00);

> closesocket (ServerSock);

> WSACleanup ();

> return totalsize;
> }



Sat, 15 Jan 2005 00:00:05 GMT  
 Winsock problem in pocket PC
Hi,

Thannks for your reply.

The connection is reset by the remort server (WSAECONNRESET).In some
servers iam able to recive data like yahoo.com. If the data received is
more than the buffer size, iam able to read only partial data and then
recv() returns 0. I am  writing the received data to the file.

What should do to keep the connection alive until i read the data fully
from the socket.

Thanks,

Nanda Kumar G.

Quote:

> And *all* you are doing is send( socket, <the message shown> ), and recv(
> socket, &somebuffer ), both in the same thread, and recv is getting a
> connection reset indication?

> Paul T.



Sat, 15 Jan 2005 09:21:39 GMT  
 Winsock problem in pocket PC
I have *never* seen this type of behavior.  Write us a sample which just
opens the connection to the server, sends the request, receives the
response, and closes the connection.  If *that* doesn't work, send it and
I'll try it on one of our devices.  I'm pretty sure you're doing something
wrong, but I can't figure out what...

Paul T.



Quote:
> Hi,

> Thannks for your reply.

> The connection is reset by the remort server (WSAECONNRESET).In some
> servers iam able to recive data like yahoo.com. If the data received is
> more than the buffer size, iam able to read only partial data and then
> recv() returns 0. I am  writing the received data to the file.

> What should do to keep the connection alive until i read the data fully
> from the socket.

> Thanks,

> Nanda Kumar G.


> > And *all* you are doing is send( socket, <the message shown> ), and
recv(
> > socket, &somebuffer ), both in the same thread, and recv is getting a
> > connection reset indication?

> > Paul T.



Sat, 15 Jan 2005 22:56:56 GMT  
 Winsock problem in pocket PC

Hi,

I have sent u the code which will open the socket connection read from
the server and write the data to a file. Try to read data from large
webpage with a small buffer size to see the porblem. Run the code in
pocket pc and ppc 2002.

Nanda Kumar G

Quote:

> I have *never* seen this type of behavior.  Write us a sample which just
> opens the connection to the server, sends the request, receives the
> response, and closes the connection.  If *that* doesn't work, send it and
> I'll try it on one of our devices.  I'm pretty sure you're doing something
> wrong, but I can't figure out what...

> Paul T.

[ test.c 2K ]
#define BUFFSIZE 2048

int socketTest(char *gHostName, char *gPath, int gPort){
        int index = 0, iReturn ;
        unsigned long totalsize;
        char szClientA[BUFFSIZE];
        wchar_t szClientW[BUFFSIZE];
        char gArr[BUFFSIZE];
        SOCKET ServerSock = INVALID_SOCKET;
        SOCKADDR_IN destination_sin;
        PHOSTENT phostent = NULL;
        WSADATA WSAData;
        totalsize = 0;
        FILE *gfd;

        if (WSAStartup (MAKEWORD(1,1), &WSAData) != 0){
                wsprintf (szError, TEXT("WSAStartup failed. Error: %d"),
                                  WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
                return ERROR;
        }

        if ((ServerSock = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET){
                wsprintf (szError, TEXT("Allocating socket failed. Error: %d"),
                                  WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
                return ERROR;
        }

        destination_sin.sin_family = AF_INET;

        if ((phostent = gethostbyname (gHostName)) == NULL){
                wsprintf (szError, TEXT("Unable to get the host name. Error: %d"),
                                  WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
                closesocket (ServerSock);
                return ERROR;
        }

        memcpy ((char FAR *)&(destination_sin.sin_addr),
                  phostent->h_addr,
                  phostent->h_length);

        destination_sin.sin_port = htons (gPort);

        sprintf(gArr,"GET %s HTTP/1.0\r\n"
                                        "User-Agent: ISRBrowser\r\n"
                                        "Accept: */*\r\n"
                                        "Connection: Keep-Alive\r\n",
                                        gPath);

        //mbstowcs(szError,gArr,strlen(gArr));
        //MessageBox(NULL,szError,_T("Request...."),MB_OK);

        if((gfd = fopen("\\Windows\\Start Menu\\tmp.txt","w+b")) == NULL){
                wsprintf (szError, TEXT("File creation error: %d"), WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Client"), MB_OK);
        }
        memset(szClientA,'\0',BUFFSIZE);
        if (connect (ServerSock,
                           (PSOCKADDR) &destination_sin,
                           sizeof (destination_sin)) == SOCKET_ERROR){

                wsprintf (szError,
                                TEXT("Connecting to the server failed. Error: %d"),
                                WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
                closesocket (ServerSock);
                return ERROR;
        }

        if (send (ServerSock, gArr, strlen(gArr), 0) == SOCKET_ERROR) {
                wsprintf (szError, TEXT("Sending data to the server failed. Error: %d"),
                        WSAGetLastError ());
                MessageBox (NULL, szError, TEXT("Error"), MB_OK);
        }

        shutdown (ServerSock, 0x01);

        totalsize = 0;

        for (;;){

                iReturn = recv (ServerSock, szClientA, BUFFSIZE, 0);

                if (iReturn == SOCKET_ERROR){
                        wsprintf (szError, TEXT("recv failed Error: %d"), WSAGetLastError ());
                        MessageBox (NULL, szError, TEXT("Client"), MB_OK);
                        break;
                } else if (iReturn == 0) {
                        MessageBox (NULL, TEXT("Finished receiving data"), TEXT("Client"),MB_OK);
                        break;
                }  else {
                        if(gfd != NULL){
                                fwrite( szClientA, sizeof( char ), iReturn,gfd );
                        }
                        totalsize += iReturn;
                        //memset(szClientA,'\0',BUFFSIZE);
                }
        }
        if(gfd != NULL){
                fclose(gfd);
        }
        swprintf(szClientW,TEXT("Total length %x "),totalsize);
        MessageBox (NULL, szClientW, TEXT("Length RECV"), MB_OK);
        shutdown (ServerSock, 0x00);
        closesocket (ServerSock);
        WSACleanup ();
        return totalsize;

- Show quoted text -

Quote:
}



Sun, 16 Jan 2005 14:48:11 GMT  
 Winsock problem in pocket PC
Well, this may seem a little stupid, but why are you surprised that, when
you call shutdown() on the socket you can no longer receive data from it?

Paul T.



Quote:
> Hi,

> I have sent u the code which will open the socket connection read from
> the server and write the data to a file. Try to read data from large
> webpage with a small buffer size to see the porblem. Run the code in
> pocket pc and ppc 2002.

> Nanda Kumar G


> > I have *never* seen this type of behavior.  Write us a sample which just
> > opens the connection to the server, sends the request, receives the
> > response, and closes the connection.  If *that* doesn't work, send it
and
> > I'll try it on one of our devices.  I'm pretty sure you're doing
something
> > wrong, but I can't figure out what...

> > Paul T.

----------------------------------------------------------------------------
----

- Show quoted text -

Quote:
> #define BUFFSIZE 2048

> int socketTest(char *gHostName, char *gPath, int gPort){
> int index = 0, iReturn ;
> unsigned long totalsize;
> char szClientA[BUFFSIZE];
> wchar_t szClientW[BUFFSIZE];
> char gArr[BUFFSIZE];
> SOCKET ServerSock = INVALID_SOCKET;
> SOCKADDR_IN destination_sin;
> PHOSTENT phostent = NULL;
> WSADATA WSAData;
> totalsize = 0;
> FILE *gfd;

> if (WSAStartup (MAKEWORD(1,1), &WSAData) != 0){
> wsprintf (szError, TEXT("WSAStartup failed. Error: %d"),
>   WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> return ERROR;
> }

> if ((ServerSock = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET){
> wsprintf (szError, TEXT("Allocating socket failed. Error: %d"),
>   WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> return ERROR;
> }

> destination_sin.sin_family = AF_INET;

> if ((phostent = gethostbyname (gHostName)) == NULL){
> wsprintf (szError, TEXT("Unable to get the host name. Error: %d"),
>   WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> closesocket (ServerSock);
> return ERROR;
> }

> memcpy ((char FAR *)&(destination_sin.sin_addr),
>   phostent->h_addr,
>   phostent->h_length);

> destination_sin.sin_port = htons (gPort);

> sprintf(gArr,"GET %s HTTP/1.0\r\n"
> "User-Agent: ISRBrowser\r\n"
> "Accept: */*\r\n"
> "Connection: Keep-Alive\r\n",
> gPath);

> //mbstowcs(szError,gArr,strlen(gArr));
> //MessageBox(NULL,szError,_T("Request...."),MB_OK);

> if((gfd = fopen("\\Windows\\Start Menu\\tmp.txt","w+b")) == NULL){
> wsprintf (szError, TEXT("File creation error: %d"), WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Client"), MB_OK);
> }
> memset(szClientA,'\0',BUFFSIZE);
> if (connect (ServerSock,
>    (PSOCKADDR) &destination_sin,
>    sizeof (destination_sin)) == SOCKET_ERROR){

> wsprintf (szError,
> TEXT("Connecting to the server failed. Error: %d"),
> WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> closesocket (ServerSock);
> return ERROR;
> }

> if (send (ServerSock, gArr, strlen(gArr), 0) == SOCKET_ERROR) {
> wsprintf (szError, TEXT("Sending data to the server failed. Error: %d"),
> WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Error"), MB_OK);
> }

> shutdown (ServerSock, 0x01);

> totalsize = 0;

> for (;;){

> iReturn = recv (ServerSock, szClientA, BUFFSIZE, 0);

> if (iReturn == SOCKET_ERROR){
> wsprintf (szError, TEXT("recv failed Error: %d"), WSAGetLastError ());
> MessageBox (NULL, szError, TEXT("Client"), MB_OK);
> break;
> } else if (iReturn == 0) {
> MessageBox (NULL, TEXT("Finished receiving data"), TEXT("Client"),MB_OK);
> break;
> }  else {
> if(gfd != NULL){
> fwrite( szClientA, sizeof( char ), iReturn,gfd );
> }
> totalsize += iReturn;
> //memset(szClientA,'\0',BUFFSIZE);
> }
> }
> if(gfd != NULL){
> fclose(gfd);
> }
> swprintf(szClientW,TEXT("Total length %x "),totalsize);
> MessageBox (NULL, szClientW, TEXT("Length RECV"), MB_OK);
> shutdown (ServerSock, 0x00);
> closesocket (ServerSock);
> WSACleanup ();
> return totalsize;
> }



Mon, 17 Jan 2005 01:34:48 GMT  
 Winsock problem in pocket PC
hi,

i use shutdown only to close write pipe and not the read pipe. if i dont
close it, the program just hangs and nothing is happening then i need to
kill the porgram.

Thanks,
Nanda Kumar G

Quote:

> Well, this may seem a little stupid, but why are you surprised that, when
> you call shutdown() on the socket you can no longer receive data from it?

> Paul T.



Mon, 17 Jan 2005 10:07:29 GMT  
 Winsock problem in pocket PC
The documentation for shutdown() says that you cannot receive or send data
on a socket which once the call has been used.  *Don't do that.*  Figure out
what the problem is with the hang and go from there.  Dropping function
calls in there in hopes of making things work without any reasonable
explanation of why is not a sensible way to debug...

Paul T.



Quote:
> hi,

> i use shutdown only to close write pipe and not the read pipe. if i dont
> close it, the program just hangs and nothing is happening then i need to
> kill the porgram.

> Thanks,
> Nanda Kumar G


> > Well, this may seem a little stupid, but why are you surprised that,
when
> > you call shutdown() on the socket you can no longer receive data from
it?

> > Paul T.



Mon, 17 Jan 2005 23:09:25 GMT  
 Winsock problem in pocket PC
If it can be of interest, I have succedded in making your code work,
removing the shutdown, and having only "GET /\r\n" as request.
With the shutdown in place, only the first recv succedded.

--
Vincenzo.



| The documentation for shutdown() says that you cannot receive or send data
| on a socket which once the call has been used.  *Don't do that.*  Figure
out
| what the problem is with the hang and go from there.  Dropping function
| calls in there in hopes of making things work without any reasonable
| explanation of why is not a sensible way to debug...
|
| Paul T.
|


| > hi,
| >
| > i use shutdown only to close write pipe and not the read pipe. if i dont
| > close it, the program just hangs and nothing is happening then i need to
| > kill the porgram.
| >
| > Thanks,
| > Nanda Kumar G
| >

| >
| > > Well, this may seem a little stupid, but why are you surprised that,
| when
| > > you call shutdown() on the socket you can no longer receive data from
| it?
| > >
| > > Paul T.
| >
|
|



Mon, 17 Jan 2005 23:24:14 GMT  
 Winsock problem in pocket PC
Thanks for ur reply,

I will try it.

Thanks for ur time.

Nanda Kumar G



Tue, 18 Jan 2005 20:48:45 GMT  
 Winsock problem in pocket PC
Hi Vincenzo and Paul G. Tobey,

Thanks a lot for your help. The code is working and iam able to retrive
the data from the server fully.

I removed the shutdown and added \r\n at the end and now its getting the
data without any problem.

Thanks a lot

Nanda Kumar G



Tue, 18 Jan 2005 21:42:45 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. Pocket PC / Pocket PC 2002: CDialog::m_bFullScreen

2. New article at Pocket PC Developer Network - Testing programs on Pocket PC

3. Pocket PC / Pocket PC 2002: CDialog::m_bFullScreen

4. what differencies are between Pocket PC SDK an Pocket PC 2002 SDK

5. need help on getting desktop PC to communicate w/ Pocket PC

6. Difference between PalmSize PC et Pocket PC

7. Serial Communication between Pocket PC and Visual C PC Application

8. make a communcation btw pc and pocket pc

9. GetSaveFileName problem on Pocket PC

10. Problem Dynamically Replace Menu in Pocket PC

11. pocket pc msxml save() problem

12. IID_IPropertyBag problem (OBEX on Pocket PC 2002)

 

 
Powered by phpBB® Forum Software