This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Still needing help with maintaining a socket connection

Old posts that have not been replied to for several years.
Locked
D
Darok

Still needing help with maintaining a socket connection

Post by Darok »

I've tried a few different ways to send a pong to the ircd. Here's what I"m getting in ssh
[21:31] RCV: @1a n Eggserv +d 5254
[21:32] RCV: 8 :Xion.scifi-net.org
[21:34] RCV: :Xion.scifi-net.org GNOTICE :No response from eggserv.scifi-net.org[*], closing link
[21:34] RCV: ERROR :Closing Link: eggserv.scifi-net.org[*] (Ping timeout)
[21:34] net: eof!(read) socket 8
[21:34] RCV: connection closed by server.
[21:34] -NOTICE- *** Notice -- No response from eggserv.scifi-net.org[*], closing link
The blue part is the ping to the connection. How would I insert a pong? I've tried a few things, like putdcc PONG my.services.name, just using PONG. and a few others. Any ideas? If you would like to see the entire script I"m using, let me know and I'll upload it to my site and make a link.

Thx to egghead for the following scriptlet that I'm using.
proc connect:rcv { idx text } {
# if connection closed: control back to eggdrop
if { $text == "" } {
putlog "RCV: connection closed by server."
return 1
}
# putlog any text that eggdrop receives
putlog "RCV: $text"
# new text should come to this proc
return 0
}
Any ideas would be greatly appreciated
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Read the IRC RFC (1459). This includes both server-server, and clinet-server connections.

My guess, is you are using a non-standard based protocol.

Are you making a services, client or server based connection to the IRCD.

These three are all different, though there isn't much between the server, and clinet based connections.

There is a suplimetary RFC (though I don't know the number, or know if it's even official) in regards to services based connections.

THese are all beyond the scope of the egghelp.org forums.
D
Darok

Post by Darok »

Making a services based connection. The only thing I really need help with is maintaining the socket connection with pong replies. The rest I can figure out on my own. Thx
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Darok wrote:Making a services based connection. The only thing I really need help with is maintaining the socket connection with pong replies. The rest I can figure out on my own. Thx
Below the part

Code: Select all


if { $text == "" } { 
      putlog "RCV: connection closed by server."
      return 1
}

insert

Code: Select all


if {[scan $text {PING :%s} pword] == 1 } {
   # Server sent PING
   putidx $idx "PONG :$pword"
   return 0
}

Note that upon making the connection to that IRC server you also must send the USER/NICK info. Read rfc1459 on the syntax for USER/NICK.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

After looking at RFC 1459, and the suplimentry RFC's (2813, 2812) (all are available HERE), it seems that you are not receiving the PING.

The output (with blue highlighting), shows no signs of a incoming PING that needs a reply.

Can you show the exact code you are using, as the code posted, doesn't seem at all wrong.

After some more reading of your post, it seems that the output is garbled. There is a number 8 on the line. From what I can see, 8 is also the IDX of the connection.

For more information on PING and PONG, see points 3.7.2 and 3.7.3 in RFC 2812.

See tcl-commands.doc for the correct usage of the putdcc command.
D
Darok

Post by Darok »

Thx egghead. I'm allready sending through the server protoccols, nick and user info. Thx again for you help.

Something else I just thought of, thx to ppslim :wink:
Should I have a listen <port> <type> to catch the pings?
Gonna try that scriptlet egghead sent.

Here's a look at the entire tcl
http://www.scifi-net.org/archive/socket.txt

and a look at the log I'm recieving from eggdrop -n
http://www.scifi-net.org/archive/log.txt
Last edited by Darok on Mon Jan 20, 2003 12:53 pm, edited 1 time in total.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

There is no need to use listen, unless you are attempting to listen and accept connections.

If you are making the connection from eggdrop, to the server, as a service, then no, you don't need a listening socket.
D
Darok

Post by Darok »

Still getting the same result. Here is a log from eggdrop -n if it helps

http://www.scifi-net.org/archive/log.txt
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Darok wrote:Still getting the same result. Here is a log from eggdrop -n if it helps

http://www.scifi-net.org/archive/log.txt
As this is not a regular client-server communication session, you will need to figure out the specifics of the server-server protocol you use.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Other method to obtain the information, include downloading a ready made service bot, and trying to figure out, what does what.
D
Darok

Post by Darok »

ok. I'll see if I can find one and take a look at it. This was soo much easier with mirc. lol Thx again for all your help.
D
Darok

Post by Darok »

OK, I think I got it working now. It's not pinging out. Just fiddled around a bit with that piece of code egghead gave me. and it's staying connected.

Code: Select all

proc connect:rcv { idx text } {
# if connection closed: control back to eggdrop
   if { $text == "" } { 
      putlog "RCV: connection closed by server."
      return 1
   }
   #---------->This Part<-----------
   if {[scan $text {8 :%s} pword] == 1 } { 
   # Server sent PING 
   putidx $idx "PONG :$pword" 
   putlog "PONG: $pword"
   return 0 
} 
   # putlog any text that eggdrop receives
   putlog "$text"
   # new text should come to this proc
   return 0
}
The "8" was actually the ping reply numeric from the IRCD. So by changing "PING" to "8", the script responds.
Thx so much for all you patience ppslim and egghead.
Locked