Results 1 to 7 of 7

Thread: [RESOLVED] WinSock Connect/DisConnect

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    359

    Resolved [RESOLVED] WinSock Connect/DisConnect

    Hi all.
    Can somebody tell me why the port sometimes is busy after a disconnect. I use Axwinsock.connect() and Axwinsock.close(). This happens only to the TCP connection, not the UDP connection. I'm using winsock in vb.net, my guess is that many think that's the problem.
    And yes I can connect after a minute or so.

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: WinSock Connect/DisConnect

    So you're saying that after disconnecting from a certain address/port, you have to wait for a minute or so to be able to connect to it again?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    359

    Re: WinSock Connect/DisConnect

    Hi
    Yes, that's the case. Strange is that sometimes it work's, but most of the time I have to wait. In my VB6 progg that does the same job, i don't have this "problem".

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: WinSock Connect/DisConnect

    Well, you shouldnt be using winsock in .Net. There are far more powerful classes to handle this. Do you think you could "swap over" to using these classes instead?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    359

    Re: WinSock Connect/DisConnect

    Well, not right on. But I know there is probably not any other way out. I'll try to make something with System.Net.Sockets, but I take it slow. When I think about it, could a switch that I connect to (Local Lan) cause this "port lock"?

  6. #6
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: WinSock Connect/DisConnect

    There really isn't any such thing as a "UDP connection."

    While it isn't the preferred way to use TCP (or UDP) in .Net, the Winsock control should be usable from VB.Net with no special headaches. I'd suggest you look closely at how your VB6 and VB.Net code is written and see what you might be doing differently.

    It is possible you're doing the same thing in both programs but never quite tested the VB6 program the same way. This sounds like the problem where a client sets a LocalPort value before connecting and/or a server sets RemotePort when accepting.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    359

    Re: WinSock Connect/DisConnect

    Hi
    You are right, I listen to a port using UDP, that port is receiving realtime data.
    The TCP connection is connected to the same IP, (another port). By sending different commands I change the UDP data, sent from the host.

    But, you solved my headache. The localport was set before connet. Now It's working without "locking" the port. I guess that I can wait a little longer before I move to .Net.Sockets.
    Thank's all for you're help.

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