Important alert: (current site time 7/16/2013 3:49:00 AM EDT)
 

winzip icon

A TCP/IP Tutorial

Email
Submitted on: 3/28/2000
By: Markus D  
Level: Beginner
User Rating: By 32 Users
Compatibility: VB 5.0, VB 6.0
Views: 61551
 
     This is a perfect example of TCP/IP used in a VB program. It demonstrates how-to act as a client, or a server.
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

4/10/2000 2:44:34 PMS4man007

Nice program with good potential. I've been looking for IP info.
Thanks !
(If this comment was disrespectful, please report it.)

 
6/10/2000 5:50:30 AMDanSocks@hotmail.com

Dude your program looks sweet but i can't open it pleeze help me!!! i opened it in vb5, winzip, frm'z etc, no -one can help me so pleeze do!!!!!!!!!!
(If this comment was disrespectful, please report it.)

 
7/26/2000 9:12:19 PMBuster

this is no tutorial.. it is just a simple program demostrating tcp/ip used in a vb program. If it was a tutorial it would have stuctured information pertaining to each function of the program. And I am not quite sure why it is in the "beginner" category because it assumes that you have vb knowledge.
(If this comment was disrespectful, please report it.)

 
7/27/2000 10:33:46 AMJoe

Nice program with good documentation for every line. Simple and to the point so thanks for this great contribution
(If this comment was disrespectful, please report it.)

 
5/21/2001 9:04:54 AMCarl Mercier

Very straightforward. Exactly the kind of code I am looking for here. Well commented and nothing fancy around it (ie: changing color buttons and such).

Thanks!
(If this comment was disrespectful, please report it.)

 
11/16/2001 1:17:06 PMpfweng@asia1.com

Good program,but i have this Error: Connection is forcefully rejected

i have test it with this setting:

Both PC_A and PC_B are able to see each other in network neigbhour.

PC_A has IP address of 127.168.0.1
PC_B has IP address of 127.168.0.2

PC_A will listen with Remote IP:127.168.0.2 and Local port:1001

PC_B will connect with Remote IP:127.168.0.1 and Remote port:1001

But PC_B has Error: Connection is forcefully rejected
(If this comment was disrespectful, please report it.)

 
11/16/2001 1:19:05 PMeng

good program, but i have this Error: Connection is forcefully rejected

my setting for this test are:
Both PC_A and PC_B are able to see each other in network neigbhour.

PC_A has IP address of 127.168.0.1
PC_B has IP address of 127.168.0.2

PC_A will listen with Remote IP:127.168.0.2 and Local port:1001

PC_B will connect with Remote IP:127.168.0.1 and Remote port:1001

But PC_B has Error: Connection is forcefully rejected
(If this comment was disrespectful, please report it.)

 
1/5/2002 5:55:03 PMXimo

Nice code! I have one question.. I always get that 40020 "Invalid operation at current state" in my own program, and once it tells me that, I never get the connection going again. What is it and how can I avoid it?
(If this comment was disrespectful, please report it.)

 
4/3/2003 1:17:52 AMLittle Rabbit Foofoo

I got my own routine working. I had to insert delays. After connecting, I wait up to 5 seconds for the winsock.state to become 7 (connected.) That avoided the "invalid operation at current state"
(If this comment was disrespectful, please report it.)

 
6/10/2004 10:32:09 AMSolitary

Eat it baby !!!
(If this comment was disrespectful, please report it.)

 
6/10/2004 10:35:16 AMSolitary

i mean it vb because you know vb like your hand's back side !!!

(If this comment was disrespectful, please report it.)

 
6/25/2004 9:18:58 PM

Nice stuff :D Get right down to the point and is well commented!
(If this comment was disrespectful, please report it.)

 
10/13/2004 9:06:36 PMJames Armstrong

nice!
(If this comment was disrespectful, please report it.)

 
4/16/2010 1:06:45 PMweijava

Hi author, could you kindly instruct me why do I get the error: "Connection is forcefully rejected" every time I tend to connect to e.g. 192.168.1.2 on port e.g. 54321 from e.g 192.168.1.3 on port e.g. 54321? thank you!
(If this comment was disrespectful, please report it.)

 
12/19/2010 11:49:21 PMG.Chenna Subramani

he dnt how close the connetion he was a contest win fu ck on planetsourcecode.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.