Raw sockets

1,168 views
Skip to first unread message

Zoltan Lajos Kis

unread,
Nov 9, 2011, 3:46:17 PM11/9/11
to nodejs
Hello,

I would like to open raw sockets in node.js (on linux machines) for
sending and receiving ethernet frames. I would appreciate any pointers
to existing projects, or guides on how to do this. I am aware of node-
pcap, but afaik, it
only supports receiving packets, but not sending them.

Thanks. Regards,
Zoltan.

Diogo Resende

unread,
Nov 9, 2011, 6:08:05 PM11/9/11
to nod...@googlegroups.com

http://nodejs.org/docs/v0.6.0/api/net.html

I think that by raw you mean not HTTP or other specific protocol. This
is the part of TCP sockets.

---
Diogo R.

Mikeal Rogers

unread,
Nov 9, 2011, 6:15:03 PM11/9/11
to nod...@googlegroups.com

No, he doesn't mean TCP sockets, he means raw sockets.

There are currently no bindings for raw sockets in node.js that i know of. Patches welcome.

-Mikeal

Liam

unread,
Nov 9, 2011, 7:15:07 PM11/9/11
to nodejs
What are the uses of raw sockets vs UDP sockets? Couldn't one form a
UDP message to fit in an ethernet frame?

Aria Stewart

unread,
Nov 9, 2011, 8:55:08 PM11/9/11
to nod...@googlegroups.com
On Wed, Nov 09, 2011 at 04:15:07PM -0800, Liam wrote:
> What are the uses of raw sockets vs UDP sockets? Couldn't one form a
> UDP message to fit in an ethernet frame?

ICMP, implementing your own TCP stack, UDP-lite, implementing SCTP, GRE, IPIP tunnels.

UDP comes with its own wrapper -- ports and checksums -- on top of Ethernet frames.

Ben Noordhuis

unread,
Nov 10, 2011, 6:20:22 AM11/10/11
to nod...@googlegroups.com
On Thu, Nov 10, 2011 at 00:15, Mikeal Rogers <mikeal...@gmail.com> wrote:
> There are currently no bindings for raw sockets in node.js that i know of. Patches welcome.

I would reject that patch. This belongs in a module.

Bradley Meck

unread,
Nov 11, 2011, 11:20:13 AM11/11/11
to nod...@googlegroups.com
Agree it should be in a module, Windows does not give people raw sockets entirely anyway (http://msdn.microsoft.com/en-us/library/windows/desktop/ms740548(v=vs.85).aspx) without a replacement stack such as winpcap. This is a really hairy field that is not commonly needed and so i don't think it should go into core. 

Mikeal Rogers

unread,
Nov 11, 2011, 2:20:55 PM11/11/11
to nod...@googlegroups.com
I think it should go in core and we should re-implemented TCP in pure JAVASCRIPT!

I'm only half joking.

> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

Tane Piper

unread,
Nov 11, 2011, 8:09:17 PM11/11/11
to nod...@googlegroups.com

Only if its run on top of a JVM running on Unix both implemented in JavaScript

Thanks,
Tane
Sent from my mobile

Jann Horn

unread,
Nov 14, 2011, 6:42:56 AM11/14/11
to nod...@googlegroups.com

And leave IP to the OS???

Am 11.11.2011 20:21 schrieb "Mikeal Rogers" <mikeal...@gmail.com>:

I think it should go in core and we should re-implemented TCP in pure JAVASCRIPT!

I'm only half joking.


On Nov 10, 2011, at November 10, 20113:20 AM, Ben Noordhuis wrote:

> On Thu, Nov 10, 2011 at 00:15...

codepilot Account

unread,
Feb 14, 2013, 3:24:09 PM2/14/13
to nod...@googlegroups.com
I've done a little bit of this, I can't imagine the performance will be any better than the kernel drivers. I can imagine huge mess of bugs and problems.

Mikeal Rogers

unread,
Feb 14, 2013, 3:28:15 PM2/14/13
to nod...@googlegroups.com
saving a memcopy from kernel to user space would end up being a pretty serious performance bump. js performance is quite nice and if you look at matt ranney's libpcap bindings he shows that you can assemble tcp in js.

-Mikeal

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

codepilot Account

unread,
Feb 14, 2013, 4:00:08 PM2/14/13
to nod...@googlegroups.com
I was working with winpcap, maybe not as good. Although I can easily see this shattering any sort of 10k/100k/?M/B socket limit in windows. Because all of the socket state would be client side and only limited by memory.

Nuno Barros

unread,
Mar 19, 2014, 6:10:20 AM3/19/14
to nod...@googlegroups.com, zoltan.l...@gmail.com
can i implement a arp request with the the Raw-socket module?

Stephen Vickers

unread,
Mar 20, 2014, 11:05:24 AM3/20/14
to nod...@googlegroups.com, zoltan.l...@gmail.com
On Wednesday, 19 March 2014 10:10:20 UTC, Nuno Barros wrote:
can i implement a arp request with the the Raw-socket module?

Why would you want to do this?

What problem are you trying to solve?

Steve

Jonathan Annett

unread,
Jul 17, 2015, 10:42:19 PM7/17/15
to nod...@googlegroups.com, zoltan.l...@gmail.com
Not every challenge a person set themselves is to solve a problem.
Why would you want to emulate an original ibm pc or pdp-11 in a raspberry pi? 
George Mallory (one of the team members in the first Mount Everest expedition) is famously quoted as having replied to the question "Why do you want to climb Mount Everest?" with the retort "Because it's there", which has been called "the most famous three words in mountaineering".

Erick Neverson

unread,
Jul 17, 2015, 11:39:30 PM7/17/15
to nod...@googlegroups.com
I actually solved this problem earlier today.  Wasn't sure how to cancel/close this post but I'm thankful you got back to me. In the end, it was just a matter of moving its declaration inside the map iterator. My intention was that each id iteration gets its own localEncounter object.

Erick


---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/34c3c197-150c-4fc2-b403-dffff3fbe571%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
You DO NOT have permission to share this e-mail address or any information contained within this e-mail whatsoever unless I clearly specify otherwise!

Stephen Vickers

unread,
Jul 20, 2015, 7:17:00 AM7/20/15
to nod...@googlegroups.com, erickn...@gmail.com
Hi Erick,

I would liked to have helped you, but I still don't understand why you were trying to implement ARP using raw sockets.

Are you able to briefly describe why you were doing this, and how you were able to solve this, it may help other people?

Steve

Are you able to 
Reply all
Reply to author
Forward
0 new messages