PyArg_ParseTuple for structs or binary data

Alvin Delagon adelagon at
Thu Apr 10 12:09:40 CEST 2008

Hello Gabriel,

I just recently discovered that struct.pack does return a string. Everything
works fine now. Thanks for the heads up!

static PyObject *
sendMessage(PyObject *self, PyObject *args)
  char *msg = "";
  int len;
  if (!PyArg_ParseTuple(args, "s#", &msg, &len))
    return NULL;
  ret = sctp_sendmsg(connSock, msg, len, 0, 0, 0x03000000, 0, 0x01, 0, 0);
  return Py_BuildValue("l", ret);

Alvin Delagon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list