Sign in to follow this  

[.net] How would I create an online (chatlike) program in Visual Basic?

This topic is 3858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not sure if this should go in "For Beginners", because I have a feeling most people know this, but it's specific to .NET programming, so I thought it might be a better idea to post it here. I've got some knowledge of Visual Basic (from a two-year course), but it's mostly limited to relatively simple applications. However, one thing I want to do with it involves users connecting to each other online. I'm not looking to do a very complex game. Really, all it would be is a series of connected chatrooms with some added features (Something like a MUD, but without NPC monsters and such). I'd imagine that I would need to have a client version of the program that connects to a server, and a server version to host the program, then have the clients send information to the server, and have it send it back to all the other clients (This is all based on assumptions, though. Correct me if I'm wrong.). However, I have no idea how to do this in Visual Basic (I'm using the .NET 2005 version, if that helps). Most tutorials I've found seem to assume knowledge of programming online applications like this, but if someone could point me in the direction of one that doesn't, I'd really appreciate that. And, of course, if anyone wants to explain it in a post, that would be great, but I'm guessing that it's relatively complex and people wouldn't want to spend that much time if there are tutorials already out there. Either way, thanks.

Share this post


Link to post
Share on other sites
The architecture you've described there will work fine.

Unless there's a good .net library out there that I'm unaware of, you'll have to code it by hand with .net sockets (ie, System.Net.Socket). For what you're doing, that'll be relatively easy. As long as it's just for chat, you won't have to worry about prediction and such to compensate for lag.

Sockets work by connecting to each other and passing chunks of bytes (called a packet). What you put into the packets is up to you. I usually split the packet up with headers, each header describing the data that follows it.

You can create the chunk of bytes by writing data into a MemoryStream.

Unfortunately, networking is something that isn't as well documented as say, graphics programming. There are introductory tutorials out there that should be good enough for chatting. For example.

Share this post


Link to post
Share on other sites
I looked at that, and I think it'll probably help a lot. I hadn't been able to find any introductory examples that weren't for older versions of Visual Basic.
Thanks.

Share this post


Link to post
Share on other sites

This topic is 3858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this