I want to code a telnet-like client. Its basically a customized mudclient. I have a lot of questions so bare with me.

Simply what is the best way to write a mudclient? Blocking? nonblocking? event-base? window messaging base?

I've written about this before, and have been trying, and then gave up, now I'm thinking to work on it again and in need of some advice/base. Here is how it works.

The problem is the server utilizes a special way (token/protocol) to properly connect o it. Which I think I got the gist with, and can properly write.

There are two sockets.

Socket#1 is on port 11111.
It sends a connect request.

When it has succesfully connected. It sends the login info (username/password).
If successful (I would assume), the server sends some arbitary data. I believe the ending of the packet is the hex value 7f.

Socket #2 is on port 11112.
After it receives the arbitary data with the 7f hex value in it, Socket#2 sends a connection request.

When it is successfully connected. It sends the login info (username/password) again.
If successful (I would assume), the server sends some arbitary data. I believe the ending of the packet is the hex value 7f.

I believe after this point, on port 11112, the client/server really communicate. Here they are free to send commands and receive data.

The user can select what character he wants to play, or roll a new one. He then can go into the actual game.

However, socket#2 on port 11112 only handles the main menu.
The actual game buffered is going thrhough socket#1 on port 11111.

Okay I hope you understand that. Let me ask more questions.

How would I handle the FD_READ / recv with the two sockets. Would I call both recv for each socket one after another? or would I use threads to simunteously handle the calls? And if using threads, how would I handle the WM calls?

I know this may seem confusing LOL it is to me atleast. If you can personally help e-mail me at xkardisx@hotmail.com or AIM me at dfcslave. :) Thanks. I think I got most of the connection thing down, but I don't know how to properly handle receiving data back properly. The , , stuff from the packet sniffer also confuses me alot. I can basically ignore that?

If you're still confused. I am asking how would I handle the recv event for the two sockets? And whats the best method? blocking? nonblocking? event? messages? threads?
Posted on 2003-05-11 17:46:12 by xkardisx
Ultimately that depends on the requirements - how many clients? Over or under 64? Over or under 1000? Do we care how much cpu time we use? They'll all work, but some are just overkill for some projects.
Larger games tend not to run from one machine anyway these days they are all multihomed networks like Blizzard's BattleNet.
That means you can generally get away with the lighter socket implementations like asynchronous. Its up to you how you database the socket handles of current clients at the server.
Posted on 2003-05-13 11:21:41 by Homer
To simply. This is a customized game client that only uses two pre-defined sockets and ports. It only connects to one server (on different ports). Basically, whats the best way to make a mudclient? LOL or telnet?

I'm having problems knowing how to handle each socket in a easy manner. If I were to use it using windows messanging, how would I know which socket is calling (sending FD_READ)? Or would I handle the FD_READ message with two calls of recv on both socket? Or would I use 2 windows to handled 2 window message loop simutaneously? Or would I use threads with events? I don't know. I'm getting a headache lol. I've seen telnet client source, but I guess reading everything makes me more confuse. But those telnet client usually only handle one socket, thus, didn't help as much as I wanted it to.

-2 sockets
-how to handle the fd_read calls for each socket? or should i use a different method to handle the 2 sockets?
Posted on 2003-05-13 13:09:04 by xkardisx
From PSDK:
The wParam parameter identifies the socket on which a network event has occurred.
Posted on 2003-05-14 06:33:18 by Aaro
ah. i guess from the examples i saw, each predined the socket (caused they only used one) ;p i figured as much but didnt know wParam or lParam.
Posted on 2003-05-14 09:00:24 by xkardisx
thanks a bunch :)
Posted on 2003-05-14 09:00:36 by xkardisx