Connecting to server

homebrew311

Active member
Joined
Oct 25, 2003
Messages
31
Hey guys,
I am just wondering how I would be able to connect to a server, get some info, and disconnect. If youve ever seen those Weather Bug programs that get the temperature every 5 minutes or so, then that is a great example of what I want to do. Another example is how SpyBot Search and Destroy checks to see if there are updates available, and if so, download them. Does andybody know how the do this in VB.net?
 
Are you connecting to some server that already exits, or are you
writing both the server and client applications?

If youre writing them yourself, Id highly reccomend creating an
XML Web Service that hands out data. Its very easy to implement
these services in ASP.NET and Windows applications.

If youre trying to access data thats already in some other
form, then youre going to have to manually download it (with
Sockets or a WebClient) and parse the data out of the string.
 
Thanks, but Im still a newbie at VB and I dont know how to do all those web services and such. Think of it this way, I give some of my programs to my friends. Lets say that I coded an "update" feature into a program I wrote. How would I have the program connect to my computer and have the host on my computer distribute the download? (Im too young to get fixed IP domains and servers and stuff)
 
This is a fairly complex thing to pull together, but it can be done.
You will need a good understanding of how the Sockets
namespace works (and there are plenty of examples in the
SDK documentation). Then its just a matter of using a TcpClient
or some other Socket to connect to your computer (assuming you
have an IP thats relatively static) and have a host app
running on your computer to accept the connection and send the
update by converting it into an array of bytes and sending it along
in small chunks.

The update itself could be in the form of a DLL of functions that
your program references, and it copied over when the program is
not running. Or you might choose to update the entire exe. Either
way, I will point out that you will need to close the main
application and have another app to update the main app.
 
Technically your port could be anything from around 1 to 1048ish.

As for the static IP address sign up to dynu.com, they do a basic version for free and it will solve any problems with a variable IP address.
 
You may be better off, learning .NET better before you try this. As this is a very big project
 
Last edited by a moderator:
If you want to connect to a NT/W2K/W2K3 server and get user/domain information. Look up LDAP. ;)
 
Back
Top