Jul 27, 2008

An Indepth Look At The Winsock Control - Part I - The Basics

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > VB Programming

free web hosting

An Indepth Look At The Winsock Control - Part I - The Basics

ghostrider
I wrote this just today. Please tell me if its written well. If you guys like it I'll continue you to write more.

An Indepth Look at the Winsock Control
Part I - The Basics

Who This Documentation Is For:
This documentation on the Winsock control is for any Visual Basic programmer that wants to learn about communication between two or more computers. Communication between computers was something I found fun to learn, and also teachs many other key concepts like string parsing and control arrays. I recommend that you have some expierence with Visual Basic, enough that you are able to handle variables and know what the functions Chr(), Asc(), Mid(), and other common functions do. You should also know the difference between functions and subs, and how to return the result from a function. You should also understand how variables work. I will add comments on any code that might not make sense.

What is covered in Part I:
In Part I, I will go over the two different protocols (ways that data is sent and how the connections are set up), what IP addresses are, and what ports are. No actual code is written in this part, however by the end we will have made a fully useable chat application that is capable of chat between 2 or more than 2 different people.

The Two Different Protocols:
Using the Winsock control there are two different protocols, or two different ways of connecting to another computer and sending data. They are named Transfer Control Protocol (TCP), which is the default protocol if you do not define one. The other much less used protocol is called User Datagram Protocol (UDP). There are many technical differences between TCP and UDP, but they do not affect us. The difference that is important that we need to concern ourselves with is this, TCP requires a connection between, and UDP does NOT.

How TCP connects to computers:
In a TCP connection, one computer is the server. The server 'listens' for incoming requests, and then either 'accepts' them or closes the connection. The client(s) 'connect' to the server. In order for you to make the connection, the client(s) need to know either the host name or IP address of the server, and the port that the server is listening on. TCP is very much like a telephone, the client(s) call the server, and the server picks up the phone. After the connection has been established, both computers can send data back and forth.

How UDP works:
Very unlike TCP, UDP does not need a connection. UDP does not have a server or a client. Each computer needs to know the port the computer is transfering data through, and the IP address of the other. UDP is suitable for sending small amounts of data between computers. UDP is like passing a note in class, no connection is needed like a telephone.

What are IP Addresses and Ports:
An IP address is like the address of your house. Each person has a different one, and it identifies you. An IP address has a format like this xxx.xxx.xxx.xxx. Not all of the x's have to be used in each set of x's. The 4 x sets can be from the values of 0 to 255. IP addresses within Local Area Networks always start with 192.xxx.xxx.xxx or 172.xxx.xxx.xxx or even 10.xxx.xxx.xxx. It is important that you understand that computers can have more than one IP address. For example right now, my computer has two, one of them being the one that it has inside of my local area network (the network I have in my house) and one for the internet, that other computers outside of my LAN know my computer as.
Each computer 65536 ports, number from 0 to 65535. Ports were designed so that data doesnt come through all at once, it can be seperated. HTTP (Hypertext Transfer Protocol) or more commonly know as web pages uses Port 80, and FTP (File Transfer Protocol) uses port 21. These ARE NOT different protocols that the Winsock control usees. Don't get confused by that. HTTP and FTP both happen to work using TCP.

 

 

 


Reply

jlhaslip
Nice work. Keep it coming.
You have a very nice approach to simplifying the material of a complex topic. I look forward to seeing more information from you on this issue. And why, exactly is it in Quote tags?

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : indepth, winsock, control, part, basics

  1. A Small Social Networking Site....
    as a part of college project (9)
  2. Winbinder Listview Control?
    Howto? Please help/hint me (0)
    Hey guys /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> Im
    trying to make a listview, heres a control that makes it possible to have a listview in winbinder
    applications. http://webscripts.softpedia.com/script/PHP...nder-22843.html I cant get it to work
    for some reasons, can someone please help me with this? I want to fetch data from a website, and
    then insert them in 5 columns, and also must be able to read the values with a button click. Hope
    thats not that too much asked, maybe you have a better idea? Thanks in advance! ....
  3. Getting Rid Of That Little Pot Belly
    Or anyother little flabby part of your body :) (0)
    Hello Trap17, this is my first post at the forums and I want it to so some good, so I am going to
    post this tutorial for some people who have noticed they have a little pot belly, and want to work
    it off effectively. Or as a matter of fact, any other parts that have become flabby /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />. 8 Minute Abs
    Don't laugh, I know the name is corny, but just wait until you see the video! Ok, what
    it is, is an 8 minute (for those who hadn't guessed) exercise which (quite q....
  4. How To Control Other Users’ Privileges (microsoft Windows Steadystate 2.5)
    (1)
    Recently Microsoft has developed a program that makes user control easier. The program is called
    Windows SteadyState 2.5 and it needs a genuine version of windows. System Requirements
    • Supported Operating Systems: Windows Vista Enterprise; Windows Vista Home Premium; Windows
    Vista Ultimate Windows XP Professional, Windows XP Home Edition, Windows XP Tablet PC Edition with
    Windows XP Service Pack 2 (SP2) installed or Service Pack 3 (SP3) installed, Windows Vista Business,
    Windows Vista Home Basic, Windows Vista Starter, or Windows Vista with Servi....
  5. Remote Control A Computer With Sound
    (2)
    Is there any program out there that you can remotely control a windows pc and have sound support. I
    have a machiene that is used for presentations in one room and in want to be able to watch the same
    presentation in another room. Any help will be greatly appreciated.....
  6. Bill Bailey's Part Troll... What Is That Thing?
    (0)
    I was watching the Bill Bailey Part Troll DVD, and was wondering what that thing is on the left that
    he has on the (our) left that he waves and it works as a kind of synthesizer. I Really don't
    know what it is, and would like to. For those of you who don't know what I'm talking about
    here is a youtube link http://au.youtube.com/watch?v=TqDl491ORqM It's the thing on the left
    that he waves his hand near and it 'squeaks'. I first thought there was strings or
    something in the loop at the front he was playing, but that seemed to be wrong, as it m....
  7. Connecting Two Computers With A Crossover Cable
    Got the basics, anything I'm missing? (7)
    I was going to connect two computers together with a crossover cable to share files, and maybe even
    play a few multiplayer games over it. In my understanding I need a cat5 crossover cable, correct me
    if I'm wrong here. Both computers need to have a network card. After I hook up the computers I
    need to set each computers IP. (I'm not to sure on how to do that) Then I need to make sure the
    computers can "talk" to each other. From what I've read that's all I need to do. Anything
    I'm missing? If someone could explain the part about setting the computers I....
  8. Incredible Rising Gas Prices
    Gas Out of Control (15)
    Talk about sticker shock. Today I had to fill up my car, $62.57!!! How in the heck
    can people drive to get to work, the store or even to a doctors appointment with gas prices like
    this??! Between Gas, food, and not even talking cigarette prices. it is unreal. You figure for
    a familly of say 4 people. 2 cars. both kids say 8 or 9 yrs old going to school. for them just to
    go 1 year at these prices. I figured it out to be close to or a little over $2000 a month.
    "here in the north eastern USA. I dont know about everyone, but I am sick and ti....
  9. Illegal Immigration And Border Control
    The ill effects of illegal immigration (21)
    The United States should put a large effort into securing our border with Mexico and preventing the
    crossing of the border by illegal immigrants and the problems that come with them. An average day
    along the border between the US and Mexico starts early in the mourning for both the sides of the
    border. The US Border Patrol Agents rise early and head to their posts, ready for another hot day
    out in the sun. When a call comes in saying that there is an illegal immigrant that has become
    stranded and disoriented out in the desert and that they need medical assistance, and ....
  10. You Control What Happens In Your Dream..?
    Soemtimes, i think I can... (22)
    I can almost feel a sub conscience in my dreams, I seem to be able to control what "I" do in my
    dreams, just ;last night, I had a dream about an all school camping trip, near the end everyone is
    gone, and i'm walking by the cabins, and i hear a girl crying, the voice sounded familiar. I
    keep on walking but I sorta think, wait, I need to go back, and I do, and it's this girl that i
    happen to be in love with, and i start talking to her in the dream and ask her whats wrong,
    something about her family leaving her there, I'm comforting her, when I just tell her th....
  11. Diabetes And Insulin Pump Therapy
    Discussion on diabetes control (4)
    I wanted to make this a Subforum but didnt know how so I posted this here. I have been a diabeteic
    for about 25 yrs. I am now on the inslin pump which seems to be working well. I was basically
    wanting to know if there are otheres diabetices that use the pump or discuss any other ways others
    could share to help other diabetices control ther sugar levels.....
  12. Java Part 1
    (2)
    The HTML <script> tag is used to insert a JavaScript into an HTML page. Examples Write text
    with Javascript - http://www.w3schools.com/js/tryit.asp?filename=tryjs_text The example
    demonstrates how to use JavaScript to write text on a web page. Write HTML with Javascript -
    http://www.w3schools.com/js/tryit.asp?file...ryjs_formattext The example demonstrates how to use
    JavaScript to write HTML tags on a web page. How to Put a JavaScript Into an HTML Page CODE
    <html> <body> [color=red]<script type="text/javascript"....
  13. Birth Control Recommendations?
    (9)
    Everything in my gut (and coming from my doctor) tells me I really need to stick to a birth control
    pill, but during my one month experience on it I began feeling depressed and decided to quit.
    I'm assuming the hormone in-balance was too much for my body to handle, and many of my peers
    told me to wait it out for another couple months to see what would happen. Is there anyone with
    similar experience that has found a pill that works for you that did not affect you in that way?
    Or just generally what have you found to be a successful method of birth control?....
  14. Do You Believe In Astrology?
    The Personality part or The Futeure (19)
    One day, I received a Phone call from the editor in chief of the magazine I write for asking me to
    write the astrology section because the section's writer was sick. I didn't care alot for
    astrology before, but for me to write this section, I had to study what astrology is.. As I read
    more.. and dive deeper inside that strange space, as I see Aries fighting with Aries and The
    Scorpion in love with The Cancer, I start to believe more and more in that astrology thing.
    Astrology really reflects the personality things, giving a blurry but kind of truth full one.. so....
  15. A Adsl Router With A Control Panel And A Log
    Help me please! (4)
    Ok so my mum is wanting me to build her a server, fine thats easy. Howver its an ADSL router in
    effect with a control panel and a type of logging system! I've seen it done but i want to
    know how so i can build this thing! So it needs to have/do the following First it needs to
    distribute the adsl over a network (4 different computers) wireless AND WIRED! It has to have a
    logging system so th user can see whos been on the net, when and what they were looking at It needs
    a type of tracking system, i guess, to remember analyze and monitor programs going thro....
  16. Gaining Total Control
    A program change question (0)
    Hi, I don't know whether there are any people here who know Cubase/Nuendo, the question is not
    software specific, but it might have a particular kind of solution in those programs. It is about
    sending a Program change, normally, on any given track, you send a program change, and, if you want
    to use a different instrument later in the song, you send another Pr. Ch. with another number.
    However, I use a virtual instrument called MyOrgan, which works like a real pipe organ. You have to
    use one certain MIDI channel for a manual, another channel for another manual, and a....
  17. Writing An Essay - Part I: Sentences
    Fragments and Run-ons (6)
    Writing essays is NOT a talent; it's a skill. As a skill, it can be honed and improved, like
    playing basketball, carving wood, or cooking. True, there are those who just do it better, as in the
    other areas mentioned, but that doesn't mean that you can't be good at it with a little
    know-how and practice. As an English teacher, it's my job to show students how to do that, so I
    figured that I would give everyone a few tips on how to improve your writing and, someday, make my
    job a little easier. The first basic building block of a good essay is to have well....
  18. Make A Song In Fruity Loops Final Part
    final part in the tutorial covering (filling out the song to be better (2)
    ok so this being the final part in this tutorial i would like to say that i give permission to remix
    the content gatherd over the course of this tutorial as it is the sole propperty of myself in and of
    that i created it. you have the permisson to, remix the origeonal content publis your remix aslong
    as you name it as (dj starskream.song title,remix by,your name,) publicly play and earn from it as
    a title produced by dj starskream but remixd by yourselfs. now if at anny time the above rules of
    remix are not followd provideing that you intend to release as a remix by yo....
  19. Making A Song In Fruity Loops Part Three
    part three precusion (1)
    ok part three now which covers the precusions setup of the small song i built for this tutorial.
    the nesecery files can be downloaded here the image below is included in the precusions folder as
    it mught not be entierly visable within this post so shold you need it its there also the images
    purpose is to enable you to see what i am refering to within this tutorial lateron. now what i
    have done above is blackd out every pattern that has nothing to do with the precusion. so the
    patterns displayed in light grey are the only patterns i will be refering to. ok lets b....
  20. Dog Care Basics
    (9)
    QUOTE Dogs and humans have been best friends for long. While dogs give unconditional love,
    loyalty and friendship to their owners, we are responsible for their proper care, food and water,
    shelter, safety, regular veterinary care and exercise. Here are some tips to take good care of your
    dogs: Collar your dog and attach an ID to it with the dog's name, your name, address, and
    telephone number. These tags are a great help when a dog gets lost to take him safely back to his
    home. Legal requirements for adopting the dog and obtaining tags are quite essential. Get y....
  21. Sleep Control
    How to control Sleep ? (15)
    Hi , i am 19 male and i have a real problem regarding my sleep timings, I wanna know actually how
    many hours in a day can a teenager sleep ? Moreover i wanna know the timings for the best sleep.I
    go to bed at 1:30 late night and get up at 7:30 . this is my routine , But the problem now is that
    during the day time almost all the time i feel sleepy, that too especially when i travell outside in
    bus or some means i feel very sleepy, Please tell me how to sleep Less ,so that i may work more.
    Suggestion are welcomed !!!....
  22. Runescape 2 Private Server Guide: Part 2
    No-ip setup (19)
    Overview: In part 2 i will describe how to set up no-ip. no-ip is a simple way of hosting a
    private server and it is most commonly used. if this does not work, there is another way i will tell
    about in part 3. part 2 and 3 are short, yet effective guides that are aimed at helping you! If
    you are not sure if it is working, it is probably because you have not read part 4: Port Forwarding
    Chapters: Chapter 1: What is No-ip? Chapter 2: Initial Setup Chapter 2 Section A:
    Creating an account Chapter 2 Section B: The DUC Chapter 3: Config Chapter....
  23. Runescape 2 Private Server Guide: Part 1
    making a private server (16)
    According to RuneScape TOS, as long as your private server does not connect/interfere with the
    actual server this 3rd party software is not breaking the real RuneScape TOS. Please use this
    information accordingly. If any RuneScape representative feels that this post is against your TOS,
    please contact Trap17 admins via PM or email. Thank you. This is part 1, focused on making a
    private server and such, if you would like, i will post more on customization in other parts.
    Overview: This guide will explain the basics for building your very own rs private server&....
  24. Ftp Account Management
    Part 2.2 of my 7 Part Cpanel Tutorial (1)
    This tutorial is an extension to my 7 tutorial series about the Cpanel. The 7 different Cpanel
    tutorials can be found below. Part 1: E-mail Management Part 2: Useful Site Management Tools
    Part 3: Useful Site Management Tools2.1 Part 4: Analysis/Log Files Part 5: Advanced Tools Part
    6: PreInstalled Scripts, Extras, and Cpanel Options Part 7: Fantastico Detailed Cpanel
    Tutorial Part 2.2: FTP Management For this tutorial, you will need to locate the Icon under
    Site Management Tools labeled FTP Manager and also inside of the FTP:// Accounts area....
  25. Cpanel Preinstalled Scripts, Extras, And Cpanel Options
    Part 6 of My 7 Part Tutorial (1)
    This Tutorial will be divided into 7 different parts, and this is the first part, when i get the
    other parts together, i will post the links under here /biggrin.gif" style="vertical-align:middle"
    emoid=":D" border="0" alt="biggrin.gif" /> Enjoy. Part 1: E-mail Management Part 2: Useful Site
    Management Tools Part 3: Useful Site Management Tools2.1 Part 4: Analysis/Log Files Part 5:
    Advanced Tools Part 7: Fantastico Detailed Cpanel Tutorial Part 4: PreInstalled Scripts,
    Extra, and Cpanel Options In this tutorial I will, in detail explain all of th....
  26. Are You Part Of The 2% Or The 98%?
    mind guessing game (18)
    2% or 98% of Population?Just follow these instructions, and answer the questions one at a time and
    as quickly as you can! Again, as quickly as you can but don't advance until you've done
    each of them .... really. Now, scroll down (but not too fast, you might miss something). THINK of
    a number from 1 to 10 MULTIPLY that number by 9 If the number is a 2-digit number, ADD the
    digits together Now SUBTRACT 5 DETERMINE which letter in the alphabet corresponds to the
    number you ended up with (example: 1=a, 2=b, 3=c,etc.) THINK of a country that....
  27. How To Acess Domain Control Panel.help Needed
    (5)
    I am very upset.I need urgent help please. My problem is that i bought a domain from Yahoo.And i put
    DNS adress of 50webs and added that domain to 50 webs and hosted it there.It is working fine
    there.but i wanted to change hosting company of my domain. But i can not access domain control panel
    from yahoo small business.My domain name doesnt appear anywhere in the domain pannel of yahoo.It
    used to be there before i hosted it here. Please anybody tell me how i can change setting of my
    domain name now.how i can bring it back to yahoo and how i can acess it? Thanks alot.....
  28. Transfer File Of Any Size Using Winsock Control
    Winsock Help (5)
    This tutorial shows how to transfer file of any size using winsock control. - Open VB; - Select
    standard exe; - Press Ctrl + t to show the add component window; - Select winsock control and
    microsoft common dialog; - Add one winsock control in the project; - Name it winsock1; - If you want
    to add chat then add another winsock and name it winsock2; - Insert another winsock object if you
    want to add chat also; - Add a microsoft common dialog box; - Name it cd; - We will use this
    winsock1 object to transfer the file and winsock2 for chat; ------------- The basic idea : ....
  29. Microsoft Publisher
    A part of Microsoft Office 2003 (7)
    Hello all, I just got my hands on the Microsoft Publisher, which comes with the Microsoft Office
    2003. I feel this is the best website designing tool ... much better than Dreamwevar and the likes.
    I had finished making my site in under 10mins. Also the menu options, to put on your site are very
    good n advance. The best part is that it not only lets you create fully customizable sites without
    knowing absolutely anything about HTML, it also allows you to do other publishing tasks like making
    greetings, stationary, visting cards etc. This is not an advert, but i think ....
  30. Your Winning Eleven
    Who will be part of your soccer dream team? (6)
    I'd Like an International Outfit mostly with German players. I prefer a fighting team rather
    than one that is star-studded. FORMATION: 4-1-2-1-2 Goal Keeper - TIMO HILDEBRAND, Vfb Stuttgart
    Very Consistent player. Should be Germany No. 1 by now. OLi isn't as fast he used to be. Jens
    is mediocre if you ask me. Left Back - PHILLIP LAHM, Vfb Stuttgart Attacking minded, pacey Winger.
    Center Back - JOHN TERRY, Chelsea Good positional Sense, good in the air and in set pieces.
    Center Back - JENS NOWOTNY, Bayer 04 Leverkusen Top Rated European Defender, Can t....

    1. Looking for indepth, winsock, control, part, basics

Searching Video's for indepth, winsock, control, part, basics
Similar
A Small
Social
Networking
Site.... -
as a part of
college
project
Winbinder
Listview
Control? -
Howto?
Please
help/hint me
Getting Rid
Of That
Little Pot
Belly - Or
anyother
little
flabby part
of your body
:)
How To
Control
Other Users’
Privileges
(microsoft
Windows
Steadystate
2.5)
Remote
Control A
Computer
With Sound
Bill
Bailey's
Part
Troll...
What Is That
Thing?
Connecting
Two
Computers
With A
Crossover
Cable - Got
the basics,
anything
I'm
missing?
Incredible
Rising Gas
Prices - Gas
Out of
Control
Illegal
Immigration
And Border
Control -
The ill
effects of
illegal
immigration
You Control
What Happens
In Your
Dream..? -
Soemtimes, i
think I
can...
Diabetes And
Insulin Pump
Therapy -
Discussion
on diabetes
control
Java Part 1
Birth
Control
Recommendati
ons?
Do You
Believe In
Astrology? -
The
Personality
part or The
Futeure
A Adsl
Router With
A Control
Panel And A
Log - Help
me
please!
Gaining
Total
Control - A
program
change
question
Writing An
Essay - Part
I: Sentences
- Fragments
and Run-ons
Make A Song
In Fruity
Loops Final
Part - final
part in the
tutorial
covering
(filling out
the song to
be better
Making A
Song In
Fruity Loops
Part Three -
part three
precusion
Dog Care
Basics
Sleep
Control -
How to
control
Sleep ?
Runescape 2
Private
Server
Guide: Part
2 - No-ip
setup
Runescape 2
Private
Server
Guide: Part
1 - making a
private
server
Ftp Account
Management -
Part 2.2 of
my 7 Part
Cpanel
Tutorial
Cpanel
Preinstalled
Scripts,
Extras, And
Cpanel
Options -
Part 6 of My
7 Part
Tutorial
Are You Part
Of The 2% Or
The 98%? -
mind
guessing
game
How To Acess
Domain
Control
Panel.help
Needed
Transfer
File Of Any
Size Using
Winsock
Control -
Winsock Help
Microsoft
Publisher -
A part of
Microsoft
Office 2003
Your Winning
Eleven - Who
will be part
of your
soccer dream
team?
advertisement



An Indepth Look At The Winsock Control - Part I - The Basics



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE