mIRC Home    About    Download    Register    News    Help

Print Thread
#208767 28/01/09 07:52 AM
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
I am trying to figure out how to get all the information that is being sent before i try to parse through the information. no binary just plain text. so i receive several lines and then i need to sort through it but right now i can only figure out how to sort through them one at a time. but if someone knows a way to parse the lines one at a time and continue until nothing else is being received then that will work too.

MTec007 #208783 28/01/09 06:06 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You'd have to store the information temporarily in a custom @window, or a file or something. Then parse through the @window/file in the on sockclose event.

hixxy #208785 28/01/09 06:36 PM
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
the socket doesnt close until i close it in mirc. but how do i know when the client is done sending info to mirc?

MTec007 #208786 28/01/09 06:49 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
That depends on the protocol being used. If this is HTTP you should be looking at the Content-Length header.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
it is http but the browser isnt sending that header for some unknown reason.

MTec007 #208789 28/01/09 07:10 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Are you sending an HTTP 1.1 request? If so, I would guess you're getting a different header, Transfer-Encoding: chunked. If that's the case you have two options: parse the chunked data (awkward), or send an HTTP 1.0 request (simple).


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
i dont know how to make the browser send HTTP/1.0 but yes it is right now sending HTTP/1.1 but mirc is not receiving the 'chunked' header

Last edited by MTec007; 28/01/09 07:38 PM.
MTec007 #208793 28/01/09 08:15 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Wait, now I'm lost. You keep saying the browser is sending you things. So you're the webserver in this scenario? In that case the HTTP 1.1 stuff is irrelevant.

There are two ways to detect the end of the data being sent by the client depending on the type of request they're making. If it's a GET/HEAD request then you just read until you hit two consecutive CRLF's marking the end of the headers (there can't be any data) and if it's a POST there should always be a Content-Length header telling you the amount of data being sent.

If you're using sockets and HTTP you should really read up on the HTTP protocol, especially if you're writing some kind of web server.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Feb 2007
Posts: 234
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 234
ok i've got this working now. I am actually reading the specs on http as i go, im trying to implement everything one at a time, so i do not start to feel overwhelmed.


Link Copied to Clipboard