Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

linking up with a system on the network.

karlonzekarlonze Member Posts: 2
hi everyone! i am new on this board and this is my very first thread.
please can anyone tell me how to connect to a system on the net using vb.

Comments

  • didanididani Member Posts: 99
    : hi everyone! i am new on this board and this is my very first thread.
    : please can anyone tell me how to connect to a system on the net using vb.
    :
    That, my friend, is truly simple. Just place a winsock control on your VB form, make it connect to the destination IP, and you're done. Now, I understand that you might be a bit puzzled by the simplicity of that, but it really is that simple!
    The only catch is where to find the winsock control. Right click in the toolbar where all your controls are, and select "Adjust" or something like that. Scroll down untill you see Microsoft Winsock Control 6.0 and make sure you check the box. Click OK and you're done. Now click the newly arisen computer icon and drag a square on the VB form. An icon, the same as the winsock icon, should appear on the form. Double click the form. Not the icon. Now, you are transferred to the code section. To the upper left of the screen, the object identifier is visible and editable. To the upper right the event identifier is visible. It should stand on "Load". The cursor is in the actual code section. Then type [code]Winsock1.connect "www.google.com", 80[/code]
    This code actually connects the computer to the server where the google-website ist hosted. And so, you are connected. If you want to connect to another computer, just replace "www.google.com" for the computername you want. This can be "www.hotmail.com" or "205.214.86.26" or something like that. The port number (80) is fixed... In this case, we connect for HTTP traffic, so we use port 80. It might be possible to desire a TELNET link. Then, you should use port 20 and port 21 for FTP.
    That's that for the client part. Now, we want a program on the other computer to accept the connection. To do this, write an identical program to the first, with one sole difference: the code should be:[code]Winsock1.localport = 80
    Winsock1.listen[/code]
    And we need to add another bit of code: Select the object identifier in the upper left corner and choose "winsock1". Then, select the event Connection Request. A new block of code should appear. In that block, insert the following:[code]winsock1.accept requestid[/code]
    Now, the entire application is complete, and ready for use.
    EtHeO out...

Sign In or Register to comment.