[Edu-sig] Re: socket-module

A[r]TA arta@x-stream.nl
Wed, 28 Jun 2000 19:26:27 +0200


> The lowest level code is imported at the top by the statement "from
> _socket import *".  This imports a module written in C.  If you have a
> Python source distribution, you can find it at Modules/socketmodule.c.

I've been looking there, and for the socket.send-option I found this:

/* s.send(data [,flags]) method */

static PyObject *
BUILD_FUNC_DEF_2(PySocketSock_send,PySocketSockObject *,s, PyObject *,args)
{
 char *buf;
 int len, n, flags = 0;
 if (!PyArg_ParseTuple(args, "s#|i", &buf, &len, &flags))
  return NULL;
 Py_BEGIN_ALLOW_THREADS
 n = send(s->sock_fd, buf, len, flags);
 Py_END_ALLOW_THREADS
 if (n < 0)
  return PySocket_Err();
 return PyInt_FromLong((long)n);
}

static char send_doc[] =
"send(data[, flags])\n\
\n\
Send a data string to the socket.  For the optional flags\n\
argument, see the Unix manual.";

-----------END CUT---------------

A stupid question maybe. I want to find the parts where is described HOW a
TCP-packet
is created. Something like:

-IP from sender
-IP from receiver
-data

Is it possible?


A[r]TA

 -Life can kick your ass, but all you got to do is stand up and move on...