CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    133

    [RESOLVED] Synchronous socket

    Hi,

    My question will seem a little bit stupid, but i been searching for hours on how to create a socket that will conect to a server and send data synchronously. I'm using the mfc CSocket class and when i check with tcpSpy i get this data :
    socket (560) created [family=AF_INET, type=SOCK_STREAM, protocol=IPPROTO_IP, dwFlags=WSA_FLAG_OVERLAPPED]
    socket (560) requested message-based event notification and enabled its nonblocking mode [hWnd=160758, wMsg=883, lEvent=FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE]
    socket (560) bound [name=0.0.0.0]
    socket (592) created [family=AF_INET, type=SOCK_STREAM, protocol=IPPROTO_IP, dwFlags=WSA_FLAG_OVERLAPPED]
    socket (592) requested message-based event notification and enabled its nonblocking mode [hWnd=160758, wMsg=883, lEvent=FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE]
    socket (592) bound [name=0.0.0.0]
    socket (560) connecting asynchronously [name=x.x.x.x:8080]
    socket (592) connecting asynchronously [name=x.x.x.x:8081]
    socket (560) receiving data synchronously without blocking [len=256]
    socket (560) could not receive data - WSAENOTCONN (A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied)
    socket (592) closed; bytes received=0, bytes sent=0
    socket (560) closed; bytes received=0, bytes sent=0
    Thanks
    Louis-Philippe Frenette
    Arobas Informatique Granby
    http://www.arobasinformatique.com

  2. #2
    Join Date
    Aug 2005
    Posts
    133

    Re: Synchronous socket

    Quote Originally Posted by shootrz
    Hi,

    My question will seem a little bit stupid, but i been searching for hours on how to create a socket that will conect to a server and send data synchronously. I'm using the mfc CSocket class and when i check with tcpSpy i get this data :


    Thanks
    Finally i wrote my own .net Socket class and it work perfectly
    Louis-Philippe Frenette
    Arobas Informatique Granby
    http://www.arobasinformatique.com

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