CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Winsock

  1. #1
    Join Date
    Mar 2007
    Posts
    2

    Winsock

    Hi
    I am using Win32 with MFC support to establish client and server connection. I am using CSocket class to accomplish this task. I like to connect many clients to the server. But, when i connect 1 client and when the client which I have connected is inthe receive mode(blocking call), i try to accept the next client. But there when I connect the next client the first client automatically gets terminated. Please tell me how I wil be able to connect many clients......

    The class MySocket is derived from CSocket class in both server and client


    Hi,
    Now I am able to connect multiple clients by chaing the CSocket as pointer. But I am having another problem. I make a client wait in the receive mode. That time I connect to another client. Now I take the SOCKET m_hSocket and attach to the CSocket connection pointer. That time when the function Attach executes, I get 'Unhandeled Exception'. I use Datach before Attach where the function Detach(detach calls kill socket inside the function). Then when I attach another SOCKET this error comes because attach calls AttachHandle where the prototype is

    AttachHandle(SOCKET hSocket, CAsyncSocket* pSocket, BOOL bDead)

    Here bDead is 0. This is not passed as an argument. Wen bDead is 1 there is no problem. What should I do in this case? Kindly help.
    Attached Files Attached Files
    Last edited by saranyas; March 20th, 2007 at 06:12 AM.

  2. #2
    Join Date
    Aug 2005
    Posts
    478

    Re: Winsock

    It is difficult to tell you without code, but you may need to choose a different socket model (async, select, iocp, etc) to effectively do what you want
    Windows XP, Visual Studio 2008, SVN

  3. #3
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Re: Winsock

    Just Check out your Code once again i am not sure That you are using multithreading here or not. and how you are trying to connect the client and as calculator already mention show your code here.so anyone can help you.
    thx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured