i have 2 program one of them in C# and the other one in visual c++.
i use Socket programing in 2 of them and i want to connect them. the program in C# is Client and the program in c is server.
when i connet client to server, conect but they are not disconnect. what i do fo that???

Edited 6 Years Ago by andisheh1362: n/a

I really have never done this so I cannot be sure. But if i would guess, I would say you need to use some sort of outside server so that the two can communicate.

I really have never done this so I cannot be sure. But if i would guess, I would say you need to use some sort of outside server so that the two can communicate.

Wow, way to spend your time publicly guessing the nature of reality and missing.

> when i connet client to server, conect but they are not disconnect. what i do fo that???

Describe what's happening in more detail, so that we understand what's going on? Show some source code? Actually close the connection?

i have 2 program one of them in C# and the other one in visual c++.
i use Socket programing in 2 of them and i want to connect them. the program in C# is Client and the program in c is server.
when i connet client to server, conect but they are not disconnect. what i do fo that???

Showing us some of your code would be helpful, also, describing what happens and the error codes that are returned are two useful troubleshooting tools.

I suspect, as a guess, that you are using the close() function to try and close your socket. Since you are using Microsoft sockets, the close() function is incorrect. Use the closesocket() function instead.

The confusion is caused by a change from the original Berkeley-style sockets. Berkeley sockets were implemented as file descriptors, and the normal close() function worked correctly with them. Microsoft sockets are not required to to be implemented this way, so close() is not certain to work correctly. The closesocket() function is supposed to work no matter how the socket was implemented.

I hope this helps.

This article has been dead for over six months. Start a new discussion instead.