Unix Programming - Writing my own socket functions

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > July 2004 > Writing my own socket functions





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Writing my own socket functions
chris

2004-07-04, 5:52 pm

As a project I want to attempt to rewrite the socket(), connect(),
send() and recv() functions and was wondering if anybody can point me in
the right direction.
Måns Rullgård

2004-07-04, 5:52 pm

chris <chris@misery.net> writes:

> As a project I want to attempt to rewrite the socket(), connect(),
> send() and recv() functions and was wondering if anybody can point me
> in the right direction.


Why would you want to do that? They are just thin wrappers around the
corresponding system calls.

--
Måns Rullgård
mru@kth.se
chris

2004-07-04, 5:52 pm

Måns Rullgård wrote:

> chris <chris@misery.net> writes:
>
>
>
>
> Why would you want to do that? They are just thin wrappers around the
> corresponding system calls.
>


Wouldn't I be able to emulate connect(), send() and recv() in userland
with a raw socket (ie. construct my own SYN packet for connect())? The
one I'm really unsure about is socket().

As for "Why?", it's just for fun and to learn.
Måns Rullgård

2004-07-05, 2:49 am

chris <chris@misery.net> writes:

> Måns Rullgård wrote:
>
>
> Wouldn't I be able to emulate connect(), send() and recv() in userland
> with a raw socket (ie. construct my own SYN packet for connect())?


I suppose you could.

> The one I'm really unsure about is socket().


You'd need the system socket() to get the raw socket.

> As for "Why?", it's just for fun and to learn.


That's always a legitimate reason.

--
Måns Rullgård
mru@kth.se
chris

2004-07-05, 5:53 pm

Måns Rullgård wrote:

> chris <chris@misery.net> writes:
>
>
>
>
> I suppose you could.
>
>
>
>
> You'd need the system socket() to get the raw socket.
>
>
>
>
> That's always a legitimate reason.
>


I have a new idea: I can write directly to a BPF device, and won't need
to use the true socket() function. My socket() function can simply
return a structure with the BPF file descriptor and anything else I
need. Feedback?
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com