UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store

Network Sites UGN Security, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
Sponsored Links
Latest Postings
by Gremelin
10/05/15 06:01 PM
Latest Reviews
Topic Options
Rate This Topic
#17668 - 09/04/02 08:47 AM Winsock Control - Advanced uses
SilentRage Offline
DollarDNS Owner

Registered: 03/04/02
Posts: 1273
Loc: OH, USA
This is a fairly simple notice for people already familiar with the uses of the Winsock control.

Trick #1 - The BIND Method

For some reason, it wasn't until recently that I discovered exactly what the Bind method can do. Previously I thought it was only good for binding UDP sockets to a port.

I was wrong. This is the answer to my prayers. Various programs give you the option of listening on any local IP. is for ANY port of course. Or you may select if you only want to accept local connections. And of course, if you have more than one IP, you can listen on any of them as well.

While this is fairly obvious in the Winsock API, until now, I thought it was outside the Winsock Control's capabilities.

Want to create a TCP listening session on Do the following:

Winsock.Bind 10000, ""

Trick #2 - UDP Broadcast

This one isn't as obvious as the other one, but just as easy. First, let me paint an example of its use.

Problem: You have a multiplayer network-enabled game, and you want to have the convenience of the game giving you a listing of all available hosted games on the network.

Solution: UDP Broadcasting! Set each host to bind a UDP socket to a single port - let's say 4500.

Host.Bind 4500, ""

Ok, now the Client has to somehow get that hosts address. Do this:

Client.RemoteHost = ""
Client.RemotePort = 4500
Client.SendData "PING"

That well send "PING" to every computer on the network targeted at port 4500! Now, the host is expecting a request like this, so it sends a response:

Host.RemoteHost = Host.RemoteHostIP
Host.SendData "PONG"

Now the client will recieve a PONG from every host on the network - and it may list each host for the user to connect to via TCP after whatever means of negotiation you want.


If you don't know how to use the Winsock Control, and would like to know, ask me to send you an example of it's use.
Domain Registration, Hosting, Management

Sponsored Links
#17669 - 09/04/02 08:37 PM Re: Winsock Control - Advanced uses
ninjaneo Offline
UGN Security Staff

Registered: 03/06/02
Posts: 256
Loc: CA, USA
now thats just fucking jeet

#17670 - 09/05/02 04:01 PM Re: Winsock Control - Advanced uses
Mornse Offline

Registered: 03/03/02
Posts: 185
Loc: Vancouver
I don't really understand the Bind. Like what would you use that for?
Cha want some w***up?

#17671 - 09/05/02 06:12 PM Re: Winsock Control - Advanced uses
SilentRage Offline
DollarDNS Owner

Registered: 03/04/02
Posts: 1273
Loc: OH, USA
Well, I was pretty clear on what it can be used for. So, I'll explain a bit about what it means to have more than one IP and the 'special' IP's.

Let's say your computer has a network card on a local network. This network card may have the IP of for example. However, your LAN doesn't have access to the internet, so you have to use a 56k dial-up connection. When you get on the internet, you now also have an internet IP given to you by your ISP. Let's say it is 12.345.6.78. These IP addresses give your applications special capabilities when they listen on a port. You see, when somebody tries to connect to your computer, not only is there a PORT it's connecting to, it's also connecting to an IP. Here, I'll explain.

You have a FTP server listening on In order for a client to connect to it, the destination IP address must be That is an IP only accessible from your network. That means ONLY people on your LAN can connect to the FTP server. If somebody tried to connect to 12.345.6.78:21 - it will be a connection refused cause there's nothing listening on that IP.

The opposite is true. Servers listening on 12.345.6.78 cannot be connected to from other computers on the LAN (unless you have some static routing going on - but that's special). However, it can easily be connected to by people on the internet.

Now, there is also a special IP If a server is listening on that IP, only programs on the same computer can connect to it. If some other computer tried connecting to well, it won't be your computer it's trying to connect to. Understand? That means you can have servers on certain IP's to restrict who can connect to it.

Another special IP is This is where a server is listening on ALL IP addresses. It doesn't matter if you're connecting to, 12.345.6.78, or - they'll all successfully connect.

The BIND method is how you can tell the winsock control on WHICH IP you want to listen on. If you don't tell it what IP you want it to listen on, it will always listen on - and you may not want that.

Now go ahead and read what I said about the BIND method above and you will better understand what I'm talking about.
Domain Registration, Hosting, Management

#17672 - 09/05/02 08:17 PM Re: Winsock Control - Advanced uses
Mornse Offline

Registered: 03/03/02
Posts: 185
Loc: Vancouver
Ahh, gotcha. Thank you very much for the explanation. That's cool shit, I'm gonna try that one time.
Cha want some w***up?

#17673 - 09/26/02 07:49 AM Re: Winsock Control - Advanced uses
psychogen Offline

Registered: 03/02/02
Posts: 257
Loc: UK
/me smiles

Nice article SilentRage

I have been using bind for the OfficeChat app I am writing part time. You may remember when I asked about DHCP detection through VB, well I after I did some reading online I found out that I was going totally the complex way of getting around to finding the OfficeChat server on a LAN, so I used bind to broadcast available servers from a central broadcasting server (with static ip) then the client can choose which server to connect to from a listview.


Bind rox0rs!!!
The use of "hacker" to mean "security breaker" is a confusion on the part of the mass media. We hackers refuse to recognize that meaning, and continue using the word to mean, "Someone who loves to program and enjoys being clever about it."
"Its not a bug, its a feature" (Epic Games)


Featured Member
Registered: 04/29/15
Posts: 2
Forum Stats
2158 Members
46 Forums
41594 Topics
76769 Posts

Max Online: 1567 @ 04/25/10 02:20 AM
Top Posters
UGN Security 34756
Gremelin 7194
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
Jan Havelles, Herbert_Sherbert, codemauve, Lillysdragon1984, Brewwit
2158 Registered Users
Who's Online
0 registered (), 241 Guests and 293 Spiders online.
Key: Admin, Global Mod, Mod
Latest News

  Get Firefox!
Get FireFox!