473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to pass a python socket to a .dll?

i'm trying to make a .dll that will let me use WSAPoll, which is a windows
sockets function, to mimic select.poll on a windows box. i cbb learning
python extensions, so i'm just going to use ctypes with a dll, so I hope
that it doesn't bring up a big performance issue. anyway, the problem is
that I want to use Python-created sockets with it, but WSAPoll requires
winsock2.h SOCKET objects.

so unless someone can tell me how to create/reference a windows socket
object using the winsock2 lib from just a file/socket descriptor (being that
this isn't a windows programming forum), i'm just asking how I could gain
access to the actual Windows socket associated with a Python socket that
Python for Windows has to store somewhere. even if I have to modify
socketmodule.c.

btw, i don't know much about this stuff, i hardly ever even program in c++,
so i hope anybody's not too cryptic :P


Jun 27 '08 #1
1 1596
En Tue, 13 May 2008 12:48:26 -0300, inhahe <in****@gmail.comescribió:
i'm trying to make a .dll that will let me use WSAPoll, which is a
windows
sockets function, to mimic select.poll on a windows box. i cbb learning
python extensions, so i'm just going to use ctypes with a dll, so I hope
that it doesn't bring up a big performance issue. anyway, the problem
is
that I want to use Python-created sockets with it, but WSAPoll requires
winsock2.h SOCKET objects.
Use the fileno() method to get the SOCKET handle.
If you're going to use ctypes anyway, why bother to write a DLL? Just
declare the required structures and functions using ctypes. Good luck!

--
Gabriel Genellina

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Nick Keighley | last post by:
I'm probably missing something rather obvious, but is there a known problem with getting a Python based socket program to communicate with a C based socket program? A simple echo server written in...
0
by: Eric Brunel | last post by:
Hi all, I just compiled Python 2.3.2 on Linux Mandrake 8.0, upgrading from Python 2.1. I have one problem that I can't figure out: when I wanted to get "the" IP address of the current host with...
13
by: Wayne Folta | last post by:
I've been a long-time Perl programmer, though I've not used a boatload of packages nor much of the tacky OO. A couple of years ago, I decided to look into Python and Ruby. Python looked OK, but...
2
by: Jos Yule | last post by:
Hello all. I doing a project which uses Macromedia's Flash program and Python. This is a 'because i want to see if i can do it' kind of thing, so i know that there will be better/easier ways to...
4
by: Edmond Rusjan | last post by:
Hi All, I'd like to use Python-2.3.4 on OSF1 V4.0, but have trouble installing. With a plain "./configure; make" build, I cannot import socket. If I uncomment the socketmodule in Modules/Setup,...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 393 open (+15) / 3315 closed (+17) / 3708 total (+32) Bugs : 908 open (+22) / 5975 closed (+49) / 6883 total (+71) RFE : 223 open...
6
by: Maxim Veksler | last post by:
Hello, I wish to do some low level network stuff using python. I've googled somewhat and came up with pylibpcap, trouble is I can't compile it on my Ubuntu 6.10 workstation. Can someone please...
3
by: brad | last post by:
I have some c++ binaries that do rather intense number computations. They do it well and rather quickly compared to other languages (not just Python). An example: In this case, c++ does one...
0
by: GeicoGecko | last post by:
Hey guys, There was no python section in the "Web Development" forum so I'm hoping I can pose my question in here. Our system We currently have a python webserver using SimpleHTTPServer,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.