Click to See Complete Forum and Search --> : Unicode vurses Non Unicode client server application with winsock2 query?


dp_76
May 16th, 2005, 07:45 AM
Hi

I have created a very basic non unicode client server application.
server is dialog based mfc app.
client is sdi mfc app.

client & server are asynchronous in nature credits to WSAAsyncSelect() function.

This application is very basic.
server creates a socket, binds itself, sets itself to asynchronous mode & waits for clients to connect.
when client connects server gets the notification message of FD_ACCEPT which it accepts.


Now i tried to create a unicode application, used the same code only with few changes such as TCHAR's instead of chars.
but in this case the server receives no notification of FD_ACCEPT .

Why is this happening?

waiting for suggestions

Best Regards
dp_76

Lee Peart
May 16th, 2005, 08:04 AM
Can't say for certain without seeing the code but, off the top of my head, it might be that you've changed the client so that it now uses multibyte character arrays in setting up the socket connection (such as in a call to gethostbyname()) when it should be using single byte character arrays. This could result in the client either failing to initialise the socket or attempting to connect to the wrong server name/ip address.

You should only need to use unicode strings for the application data. For internal application variables (such as computer names) you should stick to using the char data type.

I might be way off the mark but it's probably worth checking that your character types are correct for the job they are meant to be doing.

dp_76
May 17th, 2005, 01:33 AM
Hi
Thanx for the suggestions.

The client & server now connects successfully in my client server unicode app.

There is one problem now:

Whenever the server application closes its socket, the client donot receives the
FD_CLOSE notification where as the vice versa is happening.

There is one more strange behaviour:

I m debugging my server application line by line & when i stop debugging by pressing shift+F5, the client application in this case receives the FD_CLOSE notification.

Waiting for suggestions

Best Regards
dp_76