Reading/writting to/from IM chat client

Hi there

I'm fairly new to c++ (only 1 year experience using Visual Studio) but I've done lots of work before. I've done plenty of searches through google with no results and you'll soon know why.
The question I want to ask is how can I read input from a chat client?

What I want to do is build a basic bot program to "detect" when a message has been received. As soon as the message is received, the bot program should reply and send the message back to the person that sent the first message. What the person sends and how the program responds is of no concern to me right now as I will eventually get that working later. The main concern right now is trying to find out how to read messages sent from others and how to reply to them. I'm basically doing this for the fun because I love learning. Trying to keep one step ahead.

It would be much appreciated if any replies are given even if they aren't ones that help me. Any input is welcome

Thanks
Well you can learn socket programming =)

Do you want to create the server as well? Or are you trying to sniff another program?

I have a couple socket libraries you could probably look at, if your intent isn't malicious.


If you would like some specific help, drop me a line.
Hey thanks for the quick reply :)

Hehe na I don't intend to do anything of the sort. I'm very well aware of how annoying it is when someone tries their phishing nonsense with me.

Socket programming? Gosh I'm not that advanced yet. Seems I'm gonna need to do some heavy research. Isn't there any other way for me to detect incoming messages from any of my contacts besides using sockets? I mean the basic thing that the bot must do is chat using my chat client as if I were doing the typing i.e. Detecting incoming message and replying to them
Well it's really quite easy to program with sockets, especially if you use a library.

For instance, in my library I use the following code to communicate (server):

1
2
3
4
5
6
7
8
9
10
11
12
int main(){
 vector<int> sockets; 
 while(1){
  socket tsock = receive_connection(portNum);
  sockets.push_back(tsock);
  make_thread(sock_thread,tsock);
 }
}

sock_thread(int socket){
//here in order to receive a string use the receive() function. to send a string use send_string()
}
Last edited on
Really that simple? So what this thing is doing is connecting or listening to the port my client is using and then when I use the receive() function, it'll wait on standby until something comes through and then immediately send a string back through using send_string() ?
Well in this case It creates a new thread for each client. Which does nothing =)
however you can set up a simple receive and send_string dealio.
Thats just epicly brilliant. Simple yet so useful! Thanks a bunch. Is it possible for you to send me the library or refer me to a link or is it already installed with Visual Studio 2010? If it is in Visual Studio, whats the name of the lib so that i can include it
send me an email:
ultifinitus@gmail.com
Topic archived. No new replies allowed.