| Author |
Writing my own socket functions
|
|
|
| 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
| |
|
| 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
| |
|
| 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?
|
|
|
|