Click to See Complete Forum and Search --> : App to App connection
xxarmoxx
May 15th, 2007, 07:53 PM
I want to make a program where my app can communicate with my app on someone elses computer via the internet. What would I need to do this? Would I use tcp/ip to communcate or something else? How can I do this using VB .net 2005
Paul M
May 15th, 2007, 10:51 PM
Yes you will have to use TCP/IP and well i am not to familiar with the VB 2K5 syntax as of yet but the basis is you will need to send data and retrieve it in the data_arrival event :) Also you will need to the client and server side in one :)
xxarmoxx
May 16th, 2007, 12:41 AM
do i need a server to be involved? Cant I directly connect to eachother?
DigiRev
May 16th, 2007, 12:46 AM
One will act as the client, the other the server. One will listen/accept connections (the server), while the other connects (client).
In VB6, the best way to do this is using the Winsock control. You can use it in .NET but it's best to use the sockets class.
I don't use .NET so I have no idea how. But I've seen code all over the net for it. A simple google search would probably bring up a lot of results.
Look here:
http://www.google.com/search?client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&channel=s&hl=en&q=vb.net+sockets+class&btnG=Google+Search
Paul M
May 16th, 2007, 04:45 AM
xxarmoxx the application will need the server and client side in one. Because you wouldn't always want the user having to connect to a specific IP for the server.
xxarmoxx
May 16th, 2007, 01:10 PM
But just cause your calling one server and one client doesnt neccassarily mean I need to setup a machine as a server right? Just one peice of software 'acts' as a server and the other peice is the client. Is this correct? or do i need there to be a specified machine to be a server at all times?
DigiRev
May 16th, 2007, 01:39 PM
If it's just a 1on1 connection, you don't need a separate program to act as a dedicated server.
Just put the server code into the same program. If they choose to act as a host, then it will listen for connections. If they want to act as a client then it will connect to the other computer.
the182guy
May 17th, 2007, 03:22 AM
TCP is not the only option, don't forget there is UDP. Depends what the purpose is.
Its definately not easy in .net, theres some samples at pscode.com.
Al42
May 18th, 2007, 04:47 PM
Also be aware that, unless the two computers are on the same LAN, one or both of them may not be exposing their IP addresses. If a computer is behind a router, or a modem with a built-in router (or connected to a computer doing ICS), the router has to forward the listening port to the computer that's doing the listening (the "server").
dilettante
May 20th, 2007, 09:34 AM
One might also design the programs to "always listen" until a user clicks "connect." Then the clicked program would stop listening and attempt to connect to the other guy.
I've looked at the TCP/IP socket support in .Net a little. It just gives me more respect for the good old Winsock control.
Paul M
May 21st, 2007, 06:50 AM
.NET sockets are good but yes the good old winsock control is preferable.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.