Solved

Connecting VB via TCP/IP

Posted on 2000-04-13
9
296 Views
Last Modified: 2013-11-13
Hello--

I have a fairly simple question.. I am wanting the code that will allow more than one computer to connect to a server via TCP/IP. I have several computers that I would want to connect to a VB program running on my server, and allow simple communications between the two.  Please post code if you have it ! Thanks!!!!!

T
0
Comment
Question by:tgarspacha
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 9

Expert Comment

by:Ruchi
ID: 2712468
0
 

Author Comment

by:tgarspacha
ID: 2712489
Ruchi--

Thanks for the link..What I am looking for is a program that is simular to that, but will allow multiple connections at once.. And have ability to send messages to the server, I have no need to send them to each of the other stations connected. Thanks..

Ian
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2712584
Here are a few sites you need to visit to.
ftp://ftp.csusm.edu/pub/winworld/vbasic/ipd_102n.zip

ftp://ftp.csusm.edu/pub/winworld/vbasic/ipp_111n.zip

http://www.vbonline.com/vbonline/devsoft/vb/ipdaemon.htm
"The IPDaemon Control can be used to create TCP/IP servers running on PC's connected to a TCP/IP network. The control can handle close to 1000 simultaneous connections on the same TCP/IP port (service port). It is designed to balance the load between connections for a fast, powerful server. What follows is a short description of the control. For more information, please refer to the IP*Works! help files or printed manual. "

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=4464

http://members.xoom.com/Der_Zirkel/res/winsock.zip
"WinSock application thta demonstrates a synchronized main loop (e.g. for multiplayer; more than 2 users too)"
0
 
LVL 1

Expert Comment

by:ATM
ID: 2712697
Look at tcp server -VB version- with custom commandset and management console. www.tair.freeservers.com -VisualBasic page.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 28

Accepted Solution

by:
AzraSound earned 300 total points
ID: 2712724
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2712748
This is full source code for a Multi-Client server, it allows upto 65535 users to connnect to your server, can be customised to become any server, such as IRC, FTP. plus all the functions are in their to relay data and store information on each users accounts.
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=3387
0
 

Expert Comment

by:Arachn1d
ID: 2714673
Basically, what you need to do is this, in essence:

Create a new winsock control, and give it an index of 0. Set it's localport to the port you want to listen on.
In the form load procedure, insert winsock1.listen
In winsock1_connectionrequest, insert code like the following:

Load winsock1(winsock1.ubound+1)
winsock1(winsock1.ubound).localport=0
winsock1(winsock1.ubound).accept requestid

Now, every time a connection is made, it creates a new instance. In the winsock1_disconnect event, insert:

winsock1(index).close
unload winsock1(index)

And finally, in the winsock1_dataArrival event, insert code to deal with whatever your server does. First use:

Dim strData as String
winsock1(index).GetData strData, vbString

And then treat strData as you choose. You can send data back to the server by using winsock1(index).SendData "Whatever", remembering that CrLf's aren't automatically sent. In my code for multiple connection servers, I usually insert a timer that runs, say once a second and unloads all controls in error or disconnected states - clients wont always disconnect cleanly.
0
 
LVL 6

Expert Comment

by:st_steve
ID: 2715568
Arachn1d:

your coding is very good and will be in working condition if implemented. but..consider this...

if the server is servicing 10 requests, and the 5th and 6th connection get lost (not ending normally), winsock1 control will have problems allocating the socket to the 11th connection request.

the programmer needs to do a lot more in the connection request event, such as checking for connection errors, allocation problems, buffer space and whether maximum sockets has been reached, and if it has, get some more memory from OS to allocate more sockets.

tgarspacha:
feel free to contact me..I have written networked applications, and my coding takes care of all the problems mentioned.
0
 

Author Comment

by:tgarspacha
ID: 2715878
Thanks to everyone for all of the help!!!!!!!!!!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reading the Contents of a Directory In Access VBA 5 58
firstChar challenge 13 107
Getting warning: You are about to delete 1 row(s) 9 43
vbModal 12 34
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now