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.

help with sock connections

Old posts that have not been replied to for several years.
M
Martin2k

Post by Martin2k »

I have make A script thats connecting to the msn server, my script is online but now I need help!
how can I get a msg whitout crlf from the server.

and how can I close a connection?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

It depends what you command you used to connect to the MSN server.

Did you use TCL's socket, or eggdrop's connect command.
M
Martin2k

Post by Martin2k »

ehh I don't know but I think the eggdrop connect :smile:

Code: Select all

proc msn:connect { } {
global msn
set msn(idx) [connect $msn(serv) $msn(port)]
control $msn(idx) msn:get
msn:putchan "info" "$msn(idx) connecting to $msn(serv) $msn(port)"
putidx $msn(idx) "VER $msn(num) MSNP5 MSNP4 CVRO"
}
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

As far as I know, eggdrop strips crlf off the text for you, so you don't have to do anything. The string passed to your control procedure, msn:get, should be fine.

Also, you might want to change putidx to putdcc. Putidx is deprecated and may go away in future eggdrop versions.

To close the connection, use killdcc.
M
Martin2k

Post by Martin2k »

are there others sockets too?
what are the other sockets ?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

The stuff you're using is eggdrop's dcc support.

Tcl has commands to deal with network connections, too. Look at the 'socket' command; 'fileevent' and 'fconfigure' may be helpful.

But it doesn't sound like you need tcl sockets. Your question 'how can I get a msg whitout crlf from the server' was already answered.. didn't it work? Or maybe you could clarify your question?
M
Martin2k

Post by Martin2k »

The msn server sends a text whitout crlf and I can't get that tekst with my script :sad:
now I need to know how I can get that text.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Eggdrop doesn't need crlf... as long as there is either a cr or an lf, it will work. If your network doesn't send cr OR lf, then you shouldn't be using eggdrop sockets, use tcl's builtin ones instead. Even then it will be trickier than normal.

If it does send at least cr or lf, then something else in your script must be messed up.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

OK, after doing some basic research on the MSN protocol, I have discovered the following.

Each full command, including it's arguments is termanated with a CRLF.

When using eggdrop's "connect" tcl command, you need to put the connection under control of a script. Once this is done, the script is free to do what it wishes with the connection.

The script that is called when data is available, is passed the IDX of the connection and the data sent. The script is called once, each time it meats a CRLF.

The data the script recieves is CRLF sriped, so there is no need to get any such message, as this has allready been done for you.

To kill a connection, you use the "killdcc" command. You pass it the IDX of the connection.

For more info on the MSN protocol (and the basis of my reasearch) view This page (Section 5.2 for command syntax)
M
Martin2k

Post by Martin2k »

the server say:

Code: Select all

MSG martinkollaard@hotmail.com Martin 131
Content-Type: text/plain; charset=UTF-8
X-MMS-IM-Format: FN=MS%20Shell%20Dlg; EF=; CO=0; CS=0; PF=0

hello (no crlf)
on the last line there is no crlf :sad:
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

To get this message you would have to convert all your scripts over to TCL sockets, as Eggdrops connect and script based socket handling is not adiquate for this purpose.

According to section 8.8 of the RFC, the arguments passed with the command include the length (in bytes) of the message, including it's header.

From this, we can deduct, that the example you gave was an incorectly formatted header, most likely made op, as the details do no match.

Only TCL sockets will provide the ability to read from a socket before receiving the CRLF.

Eggdrop's connect and script controled sockets, do not provide the ability to read the data before a CRLF is received, thus the message isn;t received correctly.
M
Martin2k

Post by Martin2k »

How works the tcl sockets ?
is there a short sample ?
I don't know how I can get the msg from the server with that socket :smile:
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

TO teach you would be long winded.

Try reading up on the fconfigure, fblocking, read, gets, puts, socket and fileevent in the TCL man pages.

The TCL man pages are available here for TCL 8.0.5 Here for 8.3
M
Martin2k

Post by Martin2k »

A thanks, But how can I check of sock is open or close?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

The 'eof' command lets you know when the socket is closed.

Browse through the tcl commands like ppslim said, it tells you all the stuff you need to know :smile:
Locked