Probllem related to recv() function in winsock.h header fle
-
Hi Friends, In socket programming I want to connect double byte charcters. Earlier we used recv() function for single byte charcter. If we use double byte chracter in below recv function, its coming as a question mark symbol. If anybody knows how can I handle double byte charcter in Scoket programing(recv function),Please let me know. My codesnippet: while( bytesRecv == SOCKET_ERROR ) { bytesRecv = recv( ConnectSocket, recvbuf, 64, 0 ); if ( bytesRecv == 0 || bytesRecv == WSAECONNRESET || CheckTimeOut()) { return CloseListen(); } } Note:Here recvbuf works for singel byte not for doublebyte charcters. Thanks in advance.
-
Hi Friends, In socket programming I want to connect double byte charcters. Earlier we used recv() function for single byte charcter. If we use double byte chracter in below recv function, its coming as a question mark symbol. If anybody knows how can I handle double byte charcter in Scoket programing(recv function),Please let me know. My codesnippet: while( bytesRecv == SOCKET_ERROR ) { bytesRecv = recv( ConnectSocket, recvbuf, 64, 0 ); if ( bytesRecv == 0 || bytesRecv == WSAECONNRESET || CheckTimeOut()) { return CloseListen(); } } Note:Here recvbuf works for singel byte not for doublebyte charcters. Thanks in advance.
-
Hi Friends, In socket programming I want to connect double byte charcters. Earlier we used recv() function for single byte charcter. If we use double byte chracter in below recv function, its coming as a question mark symbol. If anybody knows how can I handle double byte charcter in Scoket programing(recv function),Please let me know. My codesnippet: while( bytesRecv == SOCKET_ERROR ) { bytesRecv = recv( ConnectSocket, recvbuf, 64, 0 ); if ( bytesRecv == 0 || bytesRecv == WSAECONNRESET || CheckTimeOut()) { return CloseListen(); } } Note:Here recvbuf works for singel byte not for doublebyte charcters. Thanks in advance.
In addition to led mike's reply... Sockets work in bytes, that's it. If you need to work with any other types then you need to do the multiplication yourself to calculate the number of bytes for a given type. recv() is confusing with its char* type - it actually has nothing to do with "characters" - it's just what the BYTE type was at the time it was designed. It's ancient, and most wish it would go away. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: