Results 1 to 6 of 6

Thread: When is bind supposed to be used?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    291

    When is bind supposed to be used?

    About my own socket protocol I downloaded, I can't correctly use Socket.Connect to connect to a local network IP. Is this where Socket.Bind should be used?

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: When is bind supposed to be used?

    I use .Bind only for UDP-connections not for TCP!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Location
    Denmark
    Posts
    291

    Re: When is bind supposed to be used?

    Quote Originally Posted by opus
    I use .Bind only for UDP-connections not for TCP!
    It IS a UDP connection. Now, when should it be used?

  4. #4
    New Member
    Join Date
    Apr 2007
    Posts
    7

    Re: When is bind supposed to be used?

    As far as I know, Bind is used to accept connections / data only on a given network interface. By default it is bound to 0.0.0.0 meaning it accepts from any network interface: loopback, LAN, or internet, but you can bind it to a given network interface

  5. #5
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: When is bind supposed to be used?

    Like Opus said, I use it on UDP server programs. I think of it like UDP's version of Winsock.Listen (which is used for TCP).

    You can use it like:

    Code:
    Winsock.Bind Winsock.LocalIP, PortNumberHere

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

    Re: When is bind supposed to be used?

    Bind has more to do with reserving a port number to one socket than anything else. The secondary function is to tie a socket to one adapter.

    This is all pretty well covered in the VB6 documentation.

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