C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 07-05-2004, 01:22 PM   #1
eam
Registered User
 
eam's Avatar
 
Join Date: Oct 2003
Posts: 53
IRC Bot

Does anyone have an IRC bot written in C++ that I could look at? I'm trying to make one but I'm not getting anywhere with it.

Thanks.
eam is offline   Reply With Quote
Old 07-05-2004, 01:46 PM   #2
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
Well have you read this yet?
ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt

I'm assuming that you've reached the stage where you can send and receive network messages.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 07-05-2004, 01:54 PM   #3
eam
Registered User
 
eam's Avatar
 
Join Date: Oct 2003
Posts: 53
Quote:
I'm assuming that you've reached the stage where you can send and receive network messages.
That's the part I'm having trouble with. I could get the bot to start connecting but I can't seem to send anything to the server no matter what I try. I've read two tutorials so don't just paste a link to one please. I really learn better by looking at working examples. I couldn't find any code for simple bots on google though.

All I need is code that connects and then maybe joins a channel or something. I think I could figure it out from there...

Oh, and yeah I've read some of ftp://ftp.rfc-editor.org/in-notes/rfc1459.txt.
eam is offline   Reply With Quote
Old 07-05-2004, 02:02 PM   #4
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
Try some of this as well then
Useful Links And Good Books
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 07-05-2004, 05:46 PM   #5
eam
Registered User
 
eam's Avatar
 
Join Date: Oct 2003
Posts: 53
I said no tutorials

I want some code, if you don't have any don't post.
eam is offline   Reply With Quote
Old 07-05-2004, 06:32 PM   #6
End Of Line
 
Hammer's Avatar
 
Join Date: Apr 2002
Posts: 6,240
>I want some code,
Then write some, and post it here when you have troubles. We'd like to help, but most people only do so when shown that you've attempted on your own first.

Also, our friend Google will undoubtably know where some source code is...

My recommendation: Break your problem down into bite-sized chunks, get each chuck working, and post it here when you can't.
__________________
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Hammer is offline   Reply With Quote
Old 07-05-2004, 09:31 PM   #7
eam
Registered User
 
eam's Avatar
 
Join Date: Oct 2003
Posts: 53
I just asked if someone knew where I could get a sample IRC bot. I didn't beg for one to be made for me. If no one knows about one, fine. And I said I tried google.

But I'm made some progress. It stops are pong though. Here is my code for it. It just stops, no response from the server, and no error until I get disconnected for a ping timeout.

Code:
sprintf(msg,"PONG :%c%c%c%c%c%c%c%c%c%c",
 buf[i+6], buf[i+7], buf[i+8], buf[i+9], buf[i+10], buf[i+11], buf[i+12],buf[i+13],13,10);

printf("\n\n--> %s",msg);

if (send(sockfd, msg, strlen(msg) + 1, 0) == -1) {
perror("send");
exit(1);
}

Last edited by eam; 07-05-2004 at 09:44 PM.
eam is offline   Reply With Quote
Old 07-06-2004, 12:02 AM   #8
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
Well that's because you should be sending a "PING"
You send a PING, the server at the other end sends a "PONG"

Oh, and get http://www.ethereal.com/
It will allow you to compare message trafffic your real IRC client generates, and the traffic your bot generates.

> I just asked if someone knew where I could get a sample IRC bot
Oh there's plenty of code - whether any of it is of the required simplicity is another matter.
Google "irc source code" for example.
A bot is simply a client without a user interface IMO
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 07-06-2004, 08:44 AM   #9
eam
Registered User
 
eam's Avatar
 
Join Date: Oct 2003
Posts: 53
No, I'm replying to the server's PING with a PONG. I used putty and entered all the exact stuff my code does and I connected. It has to be a problem in code...

And you don't need to teach me how to use google. I know how. I searched for a long time before I even thought about posting here. Google didn't find what I needed, so I asked if anyone could show me where to get it. Telling me to go back to google does not help me...
eam is offline   Reply With Quote
Old 07-06-2004, 10:49 AM   #10
Magically delicious
 
LuckY's Avatar
 
Join Date: Oct 2001
Posts: 856
Apparently you need not only a lesson on how to use google, but an attitude adjustment.

http://www.google.com/search?num=30&...va&btnG=Search

http://virtus.ath.cx/elendil/index.php?sec=dl
LuckY is offline   Reply With Quote
Old 07-06-2004, 01:46 PM   #11
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
Well the usual thing to do when it "doesn't work" is to post something approaching a complete program which doesn't work so we can all see exactly what you are doing.

That is, after you've cut out as much irrelevant detail which has no bearing on the bit which doesn't work.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Design guidelines advice - IRC Bot class IceDane C# Programming 2 12-05-2008 01:21 AM
Need some help with making irc bot kazz C++ Programming 6 11-23-2007 11:47 AM
IRC, reading the stream Iyouboushi C# Programming 6 08-03-2006 05:34 PM
Cross-compilable IRC bot radiohead C Programming 2 03-19-2006 09:27 PM
Whats wrong with my IRC Bot?? peradox Networking/Device Communication 8 05-23-2005 05:16 PM


All times are GMT -6. The time now is 11:32 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22