Sockets example

View: New views
6 Messages — Rating Filter:   Alert me  

Sockets example

by pc1oad1etter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>From what I can tell, the sockets.xul sample opens the connection to
the web server, but it somehow doesn't send the request properly.

>From ethereal:
0000  00 0f b5 5e f1 8c 00 11  24 90 9f 26 08 00 45 00   ...^.... $..&..E.
0010  00 43 93 36 40 00 40 06  4f 13 c0 a8 01 07 d8 74   .C.6@.@. O......t
0020  be 47 c7 1c 00 50 0f e0  af 94 e7 36 88 36 80 18   .G...P.. ...6.6..
0030  ff ff 89 90 00 00 01 01  08 0a 91 b5 4b 2c 1f 2b   ........ ....K,.+
0040  22 7d 48 54 54 50 20 2f  20 47 45 54 2f 31 2e 31   "}HTTP /  GET/1.1
0050  00

Rather that noting the HTTP / GET/1.1 as a request, it is labeled as
"Continuation or non-HTTP traffic"  by ethereal.  It gets an ack back
from the server.

Here's an example of a legitimate get request:

0000  00 0f b5 5e f1 8c 00 11  24 90 9f 26 08 00 45 00   ...^.... $..&..E.
0010  01 d0 93 81 40 00 40 06  fb fa c0 a8 01 07 40 e9   ....@.@. ......@.
0020  a7 13 c7 24 00 50 66 86  aa 48 fe f7 a7 e0 80 18   ...$.Pf. .H......
0030  ff ff d8 21 00 00 01 01  08 0a 91 b5 4c 08 16 5c   ...!.... ....L..\
0040  3e 98 47 45 54 20 2f 20  48 54 54 50 2f 31 2e 31   >.GET /  HTTP/1.1
0050  0d 0a 48 6f 73 74 3a 20  77 77 77 2e 67 6d 61 69   ..Host:  www.gmai
0060  6c 2e 63 6f 6d 0d 0a 55  73 65 72 2d 41 67 65 6e   l.com..U ser-Agen
0070  74 3a 20 4d 6f 7a 69 6c  6c 61 2f 35 2e 30 20 28   t: Mozil la/5.0 (
0080  4d 61 63 69 6e 74 6f 73  68 3b 20 55 3b 20 50 50   Macintos h; U; PP
0090  43 20 4d 61 63 20 4f 53  20 58 20 4d 61 63 68 2d   C Mac OS  X Mach-
00a0  4f 3b 20 65 6e 2d 55 53  3b 20 72 76 3a 31 2e 38   O; en-US ; rv:1.8
00b0  2e 31 2e 39 29 20 47 65  63 6b 6f 2f 32 30 30 37   .1.9) Ge cko/2007
00c0  31 30 32 35 20 46 69 72  65 66 6f 78 2f 32 2e 30   1025 Fir efox/2.0
00d0  2e 30 2e 39 0d 0a 41 63  63 65 70 74 3a 20 74 65   .0.9..Ac cept: te
00e0  78 74 2f 78 6d 6c 2c 61  70 70 6c 69 63 61 74 69   xt/xml,a pplicati
00f0  6f 6e 2f 78 6d 6c 2c 61  70 70 6c 69 63 61 74 69   on/xml,a pplicati
0100  6f 6e 2f 78 68 74 6d 6c  2b 78 6d 6c 2c 74 65 78   on/xhtml +xml,tex
0110  74 2f 68 74 6d 6c 3b 71  3d 30 2e 39 2c 74 65 78   t/html;q =0.9,tex
0120  74 2f 70 6c 61 69 6e 3b  71 3d 30 2e 38 2c 69 6d   t/plain; q=0.8,im
0130  61 67 65 2f 70 6e 67 2c  2a 2f 2a 3b 71 3d 30 2e   age/png, */*;q=0.
0140  35 0d 0a 41 63 63 65 70  74 2d 4c 61 6e 67 75 61   5..Accep t-Langua
0150  67 65 3a 20 65 6e 2d 75  73 2c 65 6e 3b 71 3d 30   ge: en-u s,en;q=0
0160  2e 35 0d 0a 41 63 63 65  70 74 2d 45 6e 63 6f 64   .5..Acce pt-Encod
0170  69 6e 67 3a 20 67 7a 69  70 2c 64 65 66 6c 61 74   ing: gzi p,deflat
0180  65 0d 0a 41 63 63 65 70  74 2d 43 68 61 72 73 65   e..Accep t-Charse
0190  74 3a 20 49 53 4f 2d 38  38 35 39 2d 31 2c 75 74   t: ISO-8 859-1,ut
01a0  66 2d 38 3b 71 3d 30 2e  37 2c 2a 3b 71 3d 30 2e   f-8;q=0. 7,*;q=0.
01b0  37 0d 0a 4b 65 65 70 2d  41 6c 69 76 65 3a 20 33   7..Keep- Alive: 3
01c0  30 30 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20   00..Conn ection:
01d0  6b 65 65 70 2d 61 6c 69  76 65 0d 0a 0d 0a         keep-ali ve....

Don't know if that helps any.

Sorry of this is out of thread.  I just subscribed.
_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Re: Sockets example

by Pete Collins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, yea I can confirm that the socket is sending but that's it ...

I am not seeing any errors in the console either.

So since this code is fairly old I will surmise that there has been an
underlying API change breaking the socket code.

I could be as simple as a component function rename, component class id
change, interface rename, etc ...

I will try to take a look.

--pete



Nick P wrote:

>>From what I can tell, the sockets.xul sample opens the connection to
>the web server, but it somehow doesn't send the request properly.
>
>>From ethereal:
>0000  00 0f b5 5e f1 8c 00 11  24 90 9f 26 08 00 45 00   ...^.... $..&..E.
>0010  00 43 93 36 40 00 40 06  4f 13 c0 a8 01 07 d8 74   .C.6@.@. O......t
>0020  be 47 c7 1c 00 50 0f e0  af 94 e7 36 88 36 80 18   .G...P.. ...6.6..
>0030  ff ff 89 90 00 00 01 01  08 0a 91 b5 4b 2c 1f 2b   ........ ....K,.+
>0040  22 7d 48 54 54 50 20 2f  20 47 45 54 2f 31 2e 31   "}HTTP /  GET/1.1
>0050  00
>
>Rather that noting the HTTP / GET/1.1 as a request, it is labeled as
>"Continuation or non-HTTP traffic"  by ethereal.  It gets an ack back
>from the server.
>
>Here's an example of a legitimate get request:
>
>0000  00 0f b5 5e f1 8c 00 11  24 90 9f 26 08 00 45 00   ...^.... $..&..E.
>0010  01 d0 93 81 40 00 40 06  fb fa c0 a8 01 07 40 e9   ....@.@. ......@.
>0020  a7 13 c7 24 00 50 66 86  aa 48 fe f7 a7 e0 80 18   ...$.Pf. .H......
>0030  ff ff d8 21 00 00 01 01  08 0a 91 b5 4c 08 16 5c   ...!.... ....L..\
>0040  3e 98 47 45 54 20 2f 20  48 54 54 50 2f 31 2e 31   >.GET /  HTTP/1.1
>0050  0d 0a 48 6f 73 74 3a 20  77 77 77 2e 67 6d 61 69   ..Host:  www.gmai
>0060  6c 2e 63 6f 6d 0d 0a 55  73 65 72 2d 41 67 65 6e   l.com..U ser-Agen
>0070  74 3a 20 4d 6f 7a 69 6c  6c 61 2f 35 2e 30 20 28   t: Mozil la/5.0 (
>0080  4d 61 63 69 6e 74 6f 73  68 3b 20 55 3b 20 50 50   Macintos h; U; PP
>0090  43 20 4d 61 63 20 4f 53  20 58 20 4d 61 63 68 2d   C Mac OS  X Mach-
>00a0  4f 3b 20 65 6e 2d 55 53  3b 20 72 76 3a 31 2e 38   O; en-US ; rv:1.8
>00b0  2e 31 2e 39 29 20 47 65  63 6b 6f 2f 32 30 30 37   .1.9) Ge cko/2007
>00c0  31 30 32 35 20 46 69 72  65 66 6f 78 2f 32 2e 30   1025 Fir efox/2.0
>00d0  2e 30 2e 39 0d 0a 41 63  63 65 70 74 3a 20 74 65   .0.9..Ac cept: te
>00e0  78 74 2f 78 6d 6c 2c 61  70 70 6c 69 63 61 74 69   xt/xml,a pplicati
>00f0  6f 6e 2f 78 6d 6c 2c 61  70 70 6c 69 63 61 74 69   on/xml,a pplicati
>0100  6f 6e 2f 78 68 74 6d 6c  2b 78 6d 6c 2c 74 65 78   on/xhtml +xml,tex
>0110  74 2f 68 74 6d 6c 3b 71  3d 30 2e 39 2c 74 65 78   t/html;q =0.9,tex
>0120  74 2f 70 6c 61 69 6e 3b  71 3d 30 2e 38 2c 69 6d   t/plain; q=0.8,im
>0130  61 67 65 2f 70 6e 67 2c  2a 2f 2a 3b 71 3d 30 2e   age/png, */*;q=0.
>0140  35 0d 0a 41 63 63 65 70  74 2d 4c 61 6e 67 75 61   5..Accep t-Langua
>0150  67 65 3a 20 65 6e 2d 75  73 2c 65 6e 3b 71 3d 30   ge: en-u s,en;q=0
>0160  2e 35 0d 0a 41 63 63 65  70 74 2d 45 6e 63 6f 64   .5..Acce pt-Encod
>0170  69 6e 67 3a 20 67 7a 69  70 2c 64 65 66 6c 61 74   ing: gzi p,deflat
>0180  65 0d 0a 41 63 63 65 70  74 2d 43 68 61 72 73 65   e..Accep t-Charse
>0190  74 3a 20 49 53 4f 2d 38  38 35 39 2d 31 2c 75 74   t: ISO-8 859-1,ut
>01a0  66 2d 38 3b 71 3d 30 2e  37 2c 2a 3b 71 3d 30 2e   f-8;q=0. 7,*;q=0.
>01b0  37 0d 0a 4b 65 65 70 2d  41 6c 69 76 65 3a 20 33   7..Keep- Alive: 3
>01c0  30 30 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20   00..Conn ection:
>01d0  6b 65 65 70 2d 61 6c 69  76 65 0d 0a 0d 0a         keep-ali ve....
>
>Don't know if that helps any.
>
>Sorry of this is out of thread.  I just subscribed.
>_______________________________________________
>Jslib mailing list
>Jslib@...
>http://mozdev.org/mailman/listinfo/jslib
>
>
>  
>

--
Pete Collins - Founder, Mozdev Group Inc.
www.mozdevgroup.com
Mozilla Software Development Solutions
tel: 1-719-302-5811
fax: 1-719-302-5813

_______________________________________________
Jslib mailing list
Jslib@...
http://mozdev.org/mailman/listinfo/jslib

Re: Sockets example

by pc1oad1etter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pete,

Although I could not get the client to connect to a web server
properly, when I made a small server application in VB.net, it was
able to connect, send, and receive.  I believe the only failure was
that after my server closed the connection, socket.xul did not
recognize the connection as closed.  It was closed using TcpClient's
Close() member in System.Net.Sockets in VB.net.

There's an update for you.  Maybe the something is munging up the HTTP
GET or the string in some way. the server stub I am using is not
looking for any particular protocol; it's responding to anything.

I'll still look for updates if you find something.

Thanks,
nick

On Nov 12, 2007 8:37 AM, Pete Collins <pete@...> wrote:

> Ok, yea I can confirm that the socket is sending but that's it ...
>
> I am not seeing any errors in the console either.
>
> So since this code is fairly old I will surmise that there has been an
> underlying API change breaking the socket code.
>
> I could be as simple as a component function rename, component class id
> change, interface rename, etc ...
>
> I will try to take a look.
>
> --pete
>
>
>
>
> Nick P wrote:
>
> >>From what I can tell, the sockets.xul sample opens the connection to
> >the web server, but it somehow doesn't send the request properly.
> >
> >>From ethereal:
> >0000  00 0f b5 5e f1 8c 00 11  24 90 9f 26 08 00 45 00   ...^.... $..&..E.
> >0010  00 43 93 36 40 00 40 06  4f 13 c0 a8 01 07 d8 74   .C.6@.@. O......t
> >0020  be 47 c7 1c 00 50 0f e0  af 94 e7 36 88 36 80 18   .G...P.. ...6.6..
> >0030  ff ff 89 90 00 00 01 01  08 0a 91 b5 4b 2c 1f 2b   ........ ....K,.+
> >0040  22 7d 48 54 54 50 20 2f  20 47 45 54 2f 31 2e 31   "}HTTP /  GET/1.1
> >0050  00
> >
> >Rather that noting the HTTP / GET/1.1 as a request, it is labeled as
> >"Continuation or non-HTTP traffic"  by ethereal.  It gets an ack back
> >from the server.
> >
> >Here's an example of a legitimate get request:
> >
> >0000  00 0f b5 5e f1 8c 00 11  24 90 9f 26 08 00 45 00   ...^.... $..&..E.
> >0010  01 d0 93 81 40 00 40 06  fb fa c0 a8 01 07 40 e9   ....@.@. ......@.
> >0020  a7 13 c7 24 00 50 66 86  aa 48 fe f7 a7 e0 80 18   ...$.Pf. .H......
> >0030  ff ff d8 21 00 00 01 01  08 0a 91 b5 4c 08 16 5c   ...!.... ....L..\
> >0040  3e 98 47 45 54 20 2f 20  48 54 54 50 2f 31 2e 31   >.GET /  HTTP/1.1
> >0050  0d 0a 48 6f 73 74 3a 20  77 77 77 2e 67 6d 61 69   ..Host:  www.gmai
> >0060  6c 2e 63 6f 6d 0d 0a 55  73 65 72 2d 41 67 65 6e   l.com..U ser-Agen
> >0070  74 3a 20 4d 6f 7a 69 6c  6c 61 2f 35 2e 30 20 28   t: Mozil la/5.0 (
> >0080  4d 61 63 69 6e 74 6f 73  68 3b 20 55 3b 20 50 50   Macintos h; U; PP
> >0090  43 20 4d 61 63 20 4f 53  20 58 20 4d 61 63 68 2d   C Mac OS  X Mach-
> >00a0  4f 3b 20 65 6e 2d 55 53  3b 20 72 76 3a 31 2e 38   O; en-US ; rv:1.8
> >00b0  2e 31 2e 39 29 20 47 65  63 6b 6f 2f 32 30 30 37   .1.9) Ge cko/2007
> >00c0  31 30 32 35 20 46 69 72  65 66 6f 78 2f 32 2e 30   1025 Fir efox/2.0
> >00d0  2e 30 2e 39 0d 0a 41 63  63 65 70 74 3a 20 74 65   .0.9..Ac cept: te
> >00e0  78 74 2f 78 6d 6c 2c 61  70 70 6c 69 63 61 74 69   xt/xml,a pplicati
> >00f0  6f 6e 2f 78 6d 6c 2c 61  70 70 6c 69 63 61 74 69   on/xml,a pplicati
> >0100  6f 6e 2f 78 68 74 6d 6c  2b 78 6d 6c 2c 74 65 78   on/xhtml +xml,tex
> >0110  74 2f 68 74 6d 6c 3b 71  3d 30 2e 39 2c 74 65 78   t/html;q =0.9,tex
> >0120  74 2f 70 6c 61 69 6e 3b  71 3d 30 2e 38 2c 69 6d   t/plain; q=0.8,im
> >0130  61 67 65 2f 70 6e 67 2c  2a 2f 2a 3b 71 3d 30 2e   age/png, */*;q=0.
> >0140  35 0d 0a 41 63 63 65 70  74 2d 4c 61 6e 67 75 61   5..Accep t-Langua
> >0150  67 65 3a 20 65 6e 2d 75  73 2c 65 6e 3b 71 3d 30   ge: en-u s,en;q=0
> >0160  2e 35 0d 0a 41 63 63 65  70 74 2d 45 6e 63 6f 64   .5..Acce pt-Encod
> >0170  69 6e 67 3a 20 67 7a 69  70 2c 64 65 66 6c 61 74   ing: gzi p,deflat
> >0180  65 0d 0a 41 63 63 65 70  74 2d 43 68 61 72 73 65   e..Accep t-Charse
> >0190  74 3a 20 49 53 4f 2d 38  38 35 39 2d 31 2c 75 74   t: ISO-8 859-1,ut
> >01a0  66 2d 38 3b 71 3d 30 2e  37 2c 2a 3b 71 3d 30 2e   f-8;q=0. 7,*;q=0.
> >01b0  37 0d 0a 4b 65 65 70 2d  41 6c 69 76 65 3a 20 33   7..Keep- Alive: 3
> >01c0  30 30 0d 0a 43 6f 6e 6e  65 63 74 69 6f 6e 3a 20   00..Conn ection:
> >01d0  6b 65 65 70 2d 61 6c 69  76 65 0d 0a 0d 0a         keep-ali ve....
> >
> >Don't know if that helps any.
> >
> >Sorry of this is out of thread.  I just subscribed.
> >_______________________________________________
> >Jslib mailing list
> >Jslib@...
> >http://mozdev.org/mailman/listinfo/jslib
> >
> >
> >
> >
>
> --
> Pete Collins - Founder, Mozdev Group Inc.
> www.mozdevgroup.com
> Mozilla Software Development Solutions
> tel: 1-719-302-5811
> fax: 1-719-302-5813
>
> _______________________________________________
> Jslib mailing list
> Jslib@...
> http://mozdev.org/mailman/listinfo/jslib
>
_______________________________________________
Jslib mailing list
Jslib@...
https://www.mozdev.org/mailman/listinfo/jslib

Re: Sockets example

by Rajeev J Sebastian-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Nick,

Are you trying to access an HTTP server with this ?

Regards
Rajeev J Sebastian
_______________________________________________
Jslib mailing list
Jslib@...
https://www.mozdev.org/mailman/listinfo/jslib

Re: Sockets example

by pc1oad1etter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Rajeev,

My goal it to connect via TCP to a server that I will design.  I was
using web servers just to test it to see if it would work, by opening
a connection and sending and HTTP GET command.  As I noted, however,
this did not work - but I have seen some success with a simple tcp
socket connection (with no specific command required, it just receives
anything).

nick

On Nov 14, 2007 6:00 PM, Rajeev J Sebastian <rajeev.sebastian@...> wrote:

> Hello Nick,
>
> Are you trying to access an HTTP server with this ?
>
> Regards
> Rajeev J Sebastian
> _______________________________________________
> Jslib mailing list
> Jslib@...
> https://www.mozdev.org/mailman/listinfo/jslib
>
_______________________________________________
Jslib mailing list
Jslib@...
https://www.mozdev.org/mailman/listinfo/jslib

Re: Sockets example

by Rajeev J Sebastian-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Great!

Good luck to you.

Regards
Rajeev J Sebastian

On Nov 19, 2007 10:44 PM, Nick P <nick.pend@...> wrote:

> Rajeev,
>
> My goal it to connect via TCP to a server that I will design.  I was
> using web servers just to test it to see if it would work, by opening
> a connection and sending and HTTP GET command.  As I noted, however,
> this did not work - but I have seen some success with a simple tcp
> socket connection (with no specific command required, it just receives
> anything).
>
> nick
>
>
> On Nov 14, 2007 6:00 PM, Rajeev J Sebastian <rajeev.sebastian@...> wrote:
> > Hello Nick,
> >
> > Are you trying to access an HTTP server with this ?
> >
> > Regards
> > Rajeev J Sebastian
>
> > _______________________________________________
> > Jslib mailing list
> > Jslib@...
> > https://www.mozdev.org/mailman/listinfo/jslib
> >
> _______________________________________________
> Jslib mailing list
> Jslib@...
> https://www.mozdev.org/mailman/listinfo/jslib
>
_______________________________________________
Jslib mailing list
Jslib@...
https://www.mozdev.org/mailman/listinfo/jslib