Results 1 to 6 of 6

Thread: Accepting Winsock by Sockets.Socket

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350

    Thumbs down Accepting Winsock by Sockets.Socket

    Hi, I have VB5 application with winsock, which tries to connect to my C# server.

    If I use AcceptTcpClient(), AcceptSocket() or Accept(), VB still says it's winsock is in CONNECTING state. What should I do with the Socket to accept the winsock connection?

    I can use send and receive functions, but no DataArrival event occurs.
    Last edited by Jhd.Honza; Aug 19th, 2004 at 09:44 AM.

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Accept should work, although I've only used the asynchronous BeginAccept. Are you calling Socket.Listen before Socket.Accept?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350

    Unhappy

    hmm I've found out it works, but the applications need to be in run mode, if I try to debug the code step by step, it does not connect.

    I just asked for any special tasks to make connecting winsock connected, but it seems there aren't any.

    Is there any way how to debug the code? Or why it doesn't work?

  4. #4
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    If you're using the .Accept method, and run your code through the point to execute that line of code, .Accept will block until a connection is accepted. Not sure if that helps or not, but also not sure what your code looks like.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350
    Well .NET blocks after reaching .Accept, which si ok since I run it in a new thread.

    On the client side, there is a VB code similar to this one:

    Code:
    Winsock1.Connect
    Do
     Doevents
    Loop Until Winsock1.State = sckConnected
    If I debug this code, Connect event is never faired having the winsock at sckConnecting, although .Accept method on the .NET succesfully finishes.
    However, if I run this code and set up a breakpoint on the Connect event, it works.

  6. #6
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Wish I could help, but I have no idea, don't even mess around with "Classic" VB anymore. Maybe posting in that forum might get you an answer.

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