Quote:
I'm thinking learning C++, and I figure it would be a "great" test to write my healing system for the mud, Achaea, in it. Basically I figure I could "interrupt" the incoming data from the mud and do what I would need to do based on it.
...
Sorry to infer that I already knew C, I don't
I gather you don't want to use MUSHclient's triggers, or incoming packet handling, because this is a learning project, for you to learn C++, right?
My main comment here is that this is an ambitious project to start learning C/C++ with. Unless you are planning to make this your full client, as David says, you need to somehow route the data on to your real client (so you can see it and still walk and talk).
If you want to do something like write your own client, then you could look at my "tiny MUD client" as an example to get started:
http://www.gammon.com.au/forum/bbshowpost.php?id=2206
The frustrating thing about doing TCP/IP programming, unless you are used to it, is that most operations are not "atomic". For example, to connect a client to a server does not happen instantly, because the client starts a negotiation sequence with the server (SYN/ACK packets) which may or may not eventually establish a successfull connection.
Similarly, sending data out, or receiving it from the other end, happens at its own pace. Unless you use "blocking" protocols (which have their own problems) you basically initiate the transfer, and get notified later when it has succeeded.
The tiny client code above illustrates some of this, but you need to be aware that incoming data is not necessarily one line. So you need to do what MUSHclient does, and wait for an end-of-line (newline) character before attempting to process a line. However such a character does not even arrive in some cases (eg. when being asked the initial username/password). |