do_handshake_on_connect should not be specified for non-blocking sockets

2018-02-23 Thread Etienne Robillard
)   File "/usr/lib/python2.7/httplib.py", line 844, in send     self.connect()   File "/usr/lib/python2.7/httplib.py", line 1263, in connect     server_hostname=server_hostname)   File "/usr/lib/python2.7/ssl.py", line 363, in wrap_socket     _context=self)   File "/u

Re: Sockets but calling from different programs

2017-10-25 Thread Cameron Simpson
On 23Oct2017 05:33, T Obulesu wrote: I'm new to python3 and scratching my head to write a program for this logic: The tutor list might be a better place for such questions, but since we're here... classA.py Class A: # class for socket communication basic init method that

Sockets but calling from different programs

2017-10-23 Thread T Obulesu
I'm new to python3 and scratching my head to write a program for this logic: classA.py Class A: # class for socket communication basic init method that initializes port, address, connection method send(message): # for sending any message through the given por

Re: Sockets: IPPROTO_IP not supported

2017-01-16 Thread Peter Pearson
On Mon, 16 Jan 2017 10:17:06 +, Joseph L. Casale wrote: >> Trying to sniff Ethernet packets, I do this: >> >>s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP) >> >> but it results in this: >> >> $ sudo python3 sniff_survey.py >> Traceback (most recent call last)

RE: Sockets: IPPROTO_IP not supported

2017-01-16 Thread Joseph L. Casale
> Trying to sniff Ethernet packets, I do this: > >s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP) > > but it results in this: > > $ sudo python3 sniff_survey.py > Traceback (most recent call last): > File "sniff_survey.py", line 118, in > s = socket

Sockets: IPPROTO_IP not supported

2017-01-15 Thread Peter Pearson
Trying to sniff Ethernet packets, I do this: s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP) but it results in this: $ sudo python3 sniff_survey.py Traceback (most recent call last): File "sniff_survey.py", line 118, in s = socket.socket(socket.A

Unable to sniff outgoing traffic using raw sockets in python2.7

2016-11-17 Thread Ayush Aggarwal
Hello, Following is my code : #!/usr/bin/python import socket import struct import binascii rawSocket = socket.socket(socket.PF_PACKET,socket.SOCK_RAW,socket.htons(0x0800)) # use 0x0800 for IPv4 packets , 0x0003 is for sniffing all kinds of packets while True: pkt= rawSocket.recvfrom(2

Pyaudio and sockets

2016-03-28 Thread Shiva Upreti
I am trying to send audio using sockets to a different PC, but audio is not clear on the other end and I cant understand why. Here is the code: import socket import pyaudio import wave import sys import pickle import time HOST="" PORT=1061 s=socket.socket(socket.AF_INET, socket.S

Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread sohcahtoa82
On Friday, October 16, 2015 at 2:44:53 AM UTC-7, lucasfneves14 wrote: > How did you do it? I took the advice of just being myself. -- https://mail.python.org/mailman/listinfo/python-list

Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread Random832
lucasfneves14 writes: > How did you do it? That's an impressive reply gap. If anyone's wondering, this is apparently in reply to this from March: http://thread.gmane.org/gmane.comp.python.general/774441 -- https://mail.python.org/mailman/listinfo/python-list

Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread Grant Edwards
On 2015-10-16, lucasfneves14 wrote: > How did you do it? I just climbed in and pushed the button. Same as always. -- Grant Edwards grant.b.edwardsYow! This MUST be a good at party -- My RIB CAGE is

Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread Mark Lawrence
On 16/10/2015 10:44, lucasfneves14 wrote: How did you do it? I conned my way in, nobody suspected it. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list

Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread lucasfneves14
How did you do it? -- https://mail.python.org/mailman/listinfo/python-list

Re: Using ssl module over custom sockets

2015-06-08 Thread Johannes Bauer
On 08.06.2015 09:22, jbauer.use...@gmail.com wrote: > Something that I could always use as a workaround would be to open up a > listening port locally in one thread and connection to that local port in a > different thread, then forward packets. But that's pretty ugly and I'd like > to avoid it

Using ssl module over custom sockets

2015-06-08 Thread jbauer . usenet
apped in a class. The things I can provide are send/recv methods, but nothing specific to UNIX sockets (getsockopt, etc). Could I use the Python ssl module to perform a SSL connection over such a line? Something that I could always use as a workaround would be to open up a listening port local

Re: TCP sockets python timeout public IP adresss

2015-03-30 Thread bobbdeep
On Sunday, March 29, 2015 at 2:27:59 PM UTC+5:30, bobbdeep wrote: > I am trying to communicate between a server and client using TCP sockets. > > Server code: > > import socket > import sys > > # Create a TCP/IP socket > sock = socket.socket(socket.

Re: TCP sockets python timeout public IP adresss

2015-03-29 Thread mm0fmf
On 29/03/2015 12:20, bobbdeep wrote: How do I add a port to the list of open ports on my server ? Ask the system administrator. -- https://mail.python.org/mailman/listinfo/python-list

Re: TCP sockets python timeout public IP adresss

2015-03-29 Thread bobbdeep
On Sunday, March 29, 2015 at 3:44:43 PM UTC+5:30, mm0fmf wrote: > On 29/03/2015 09:57, bobbydeep wrote: > > From the error (10060) it looks like Windows but it would be nice if > you could say which Python and OS you were using. > > I haven't looked at your code but just taking at face value th

Re: TCP sockets python timeout public IP adresss

2015-03-29 Thread mm0fmf
On 29/03/2015 09:57, bobbydeep wrote: From the error (10060) it looks like Windows but it would be nice if you could say which Python and OS you were using. I haven't looked at your code but just taking at face value that it does work internally. server_address = ('my-server-ipadress', 199

Re: TCP sockets python timeout public IP adresss

2015-03-29 Thread bobbdeep
Changed server code to the following, from socket import * HOST = '' PORT = 8080 serversocket = socket(AF_INET,SOCK_STREAM) serversocket.bind((HOST,PORT)) serversocket.listen(5) while True: (clientsocket, address) = serversocket.accept() print ("Got client request from",address) clien

TCP sockets python timeout public IP adresss

2015-03-29 Thread bobbydeep
I am trying to communicate between a server and client using TCP sockets. Server code: import socket import sys # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Bind the socket to the port server_address = ('my-server-ipadress&#

Re: array/list of sockets

2013-10-27 Thread rusi
On Sunday, October 27, 2013 4:47:16 AM UTC+5:30, theel...@gmail.com wrote: > I apologize but I do not understand what you mean by "lack of context." I > have > taken Chris' words into consideration, for my previous post was supposed to > be > my last (I just had to say thank you). This is my fi

Re: array/list of sockets

2013-10-26 Thread rurpy
On 10/26/2013 05:17 PM, theelder...@gmail.com wrote: > I apologize but I do not understand what you mean by "lack of > context." I have taken Chris' words into consideration, for my > previous post was supposed to be my last (I just had to say thank > you). This is my first google groups post, so I

Re: array/list of sockets

2013-10-26 Thread Chris Angelico
On Sun, Oct 27, 2013 at 10:56 AM, wrote: > Yes, crystal clear. Thank you. Since I am writing this post, I have one final > question. I got my code to work for a multithreaded web server, how do I test > if it can handle multiple threads? Easy! Just make sure the threads take a good bit of time

Re: array/list of sockets

2013-10-26 Thread theelder777
On Saturday, October 26, 2013 4:36:04 PM UTC-7, Mark Lawrence wrote: > That's okay, everybody has to start somewhere :) > > > > A definition from http://www.thefreedictionary.com/context "The part of > > a text or statement that surrounds a particular word or passage and > > determines its

Re: array/list of sockets

2013-10-26 Thread Mark Lawrence
On 27/10/2013 00:17, theelder...@gmail.com wrote: I apologize but I do not understand what you mean by "lack of context." I have taken Chris' words into consideration, for my previous post was supposed to be my last (I just had to say thank you). This is my first google groups post, so I am a

Re: array/list of sockets

2013-10-26 Thread mm0fmf
On 27/10/2013 00:17, theelder...@gmail.com wrote: I apologize but I do not understand what you mean by "lack of context." I have taken Chris' words into consideration, for my previous post was supposed to be my last (I just had to say thank you). This is my first google groups post, so I am a

Re: array/list of sockets

2013-10-26 Thread Chris Angelico
On Sun, Oct 27, 2013 at 10:17 AM, wrote: > > I apologize but I do not understand what you mean by "lack of context." I > have taken Chris' words into consideration, for my previous post was supposed > to be my last (I just had to say thank you). This is my first google groups > post, so I am a

Re: array/list of sockets

2013-10-26 Thread theelder777
I apologize but I do not understand what you mean by "lack of context." I have taken Chris' words into consideration, for my previous post was supposed to be my last (I just had to say thank you). This is my first google groups post, so I am a total noob. Once again, I apologize for whatever th

Re: array/list of sockets

2013-10-26 Thread Mark Lawrence
On 26/10/2013 23:42, theelder...@gmail.com wrote: Thank you all for your time and great replies. I think/hope I have enough info to able to implement this simple server. No problem but please take onboard the advice Chris Angelico gave you earlier regarding google groups, noting the complete

Re: array/list of sockets

2013-10-26 Thread theelder777
Thank you all for your time and great replies. I think/hope I have enough info to able to implement this simple server. -- https://mail.python.org/mailman/listinfo/python-list

Re: array/list of sockets

2013-10-26 Thread Mark Lawrence
On 26/10/2013 23:15, theelder...@gmail.com wrote: Thank you for your quick replies. I am trying to implement a very simple multithreaded webserver in python. Is using an array of sockets (for different clients) the correct way to go? It's a list :) And if it works for you, why not, th

Re: array/list of sockets

2013-10-26 Thread Chris Angelico
On Sun, Oct 27, 2013 at 9:15 AM, wrote: > Thank you for your quick replies. I am trying to implement a very simple > multithreaded webserver in python. Is using an array of sockets (for > different clients) the correct way to go? Firstly, before you respond any more, please get o

Re: array/list of sockets

2013-10-26 Thread theelder777
Thank you for your quick replies. I am trying to implement a very simple multithreaded webserver in python. Is using an array of sockets (for different clients) the correct way to go? -- https://mail.python.org/mailman/listinfo/python-list

Re: array/list of sockets

2013-10-26 Thread Johannes Findeisen
Hi, On Sat, 26 Oct 2013 14:41:15 -0700 (PDT) theelder777@ wrote: > Hello all, I am kind of new to python. I am currently trying to make and use > a list/array of sockets in a program. So I have declared an array as follows: > myCSocks = ['CSock1', 'CSock2', '

Re: array/list of sockets

2013-10-26 Thread Mark Lawrence
On 26/10/2013 22:41, theelder...@gmail.com wrote: Hello all, I am kind of new to python. I am currently trying to make and use a list/array of sockets in a program. So I have declared an array as follows: myCSocks = ['CSock1', 'CSock2', 'CSock3', 'CSock4

array/list of sockets

2013-10-26 Thread theelder777
Hello all, I am kind of new to python. I am currently trying to make and use a list/array of sockets in a program. So I have declared an array as follows: myCSocks = ['CSock1', 'CSock2', 'CSock3', 'CSock4', 'CSock5'] and I am trying to u

Re: Module for dialoging with intercative programs, sockets, files, etc.

2013-08-06 Thread William Ray Wing
On Aug 6, 2013, at 4:44 AM, Ulrich Eckhardt wrote: > Am 05.08.2013 21:38, schrieb Olive: >> I have found telnetlib which make very easy to interact with a telnet >> server, especially the read_until command. I wonder if something >> similar exits for other things that a telnet server. > > It's

Re: Module for dialoging with intercative programs, sockets, files, etc.

2013-08-06 Thread Ulrich Eckhardt
Am 05.08.2013 21:38, schrieb Olive: I have found telnetlib which make very easy to interact with a telnet server, especially the read_until command. I wonder if something similar exits for other things that a telnet server. It's not Python and I haven't played with it extensively, but there is

Module for dialoging with intercative programs, sockets, files, etc.

2013-08-05 Thread Olive
I have found telnetlib which make very easy to interact with a telnet server, especially the read_until command. I wonder if something similar exits for other things that a telnet server. I for the moment have in mind interacting with a GSM modem (we do it by reading and writing a pseudo serial

Re: Bluetooth Sockets

2013-07-16 Thread Christian Heimes
Am 13.07.2013 10:53, schrieb Simfake Fake: > Hi. I'm trying to connect to a bluetooth serial adaptor using python > 3.x. However, in python 3.3.2 win x32, I get "AttributeError: module has > no attribute AF_..." when trying to use socket.AF_BLUETOOTH, despite the > docs http://docs.python.org/3.3/l

Re: Bluetooth Sockets

2013-07-16 Thread Chris Angelico
On Tue, Jul 16, 2013 at 3:52 PM, Simfake Fake wrote: > Just bumping this, but has anybody have any personal experience with > bluetooth in python 3? Perhaps my issue is that the windows version doesn't > include it? I haven't worked with Bluetooth in Python, but my reading of the socket module do

Re: Bluetooth Sockets

2013-07-16 Thread Simfake Fake
Just bumping this, but has anybody have any personal experience with bluetooth in python 3? Perhaps my issue is that the windows version doesn't include it? On Sat, Jul 13, 2013 at 6:23 PM, Simfake Fake wrote: > Hi. I'm trying to connect to a bluetooth serial adaptor using python 3.x. > However,

Bluetooth Sockets

2013-07-13 Thread Simfake Fake
Hi. I'm trying to connect to a bluetooth serial adaptor using python 3.x. However, in python 3.3.2 win x32, I get "AttributeError: module has no attribute AF_..." when trying to use socket.AF_BLUETOOTH, despite the docs http://docs.python.org/3.3/library/socket.html . The code I have is very simila

Re: python sockets question

2013-05-15 Thread Andrew Berg
On 2013.05.15 20:47, Eric Miller wrote: > Can python sockets be used to capture IP traffic when the traffic is > originating from a non-python source? Python just exposes the underlying OS socket interface. There is nothing special about sockets in Python. The whole point is to c

python sockets question

2013-05-15 Thread Eric Miller
Can python sockets be used to capture IP traffic when the traffic is originating from a non-python source? Using a Lantronix UDS-1100 serial to IP converter. The goal is to write a small proof of concept piece in Python to capture serial data output by this device over IP. I've done a c

Re: Problems with sockets and threads

2013-04-11 Thread Dexter Deejay
Thanks! :D -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with sockets and threads

2013-04-11 Thread Peter Otten
Dexter Deejay wrote: > When i try to run this code and to connect to server (server is written in > java that part of code is ok) everything stalls. Thread that i created > here occupies processor all the time and GUI freezes. It's supposed to be > waiting for message from server. (asynchronous on

Re: Problems with sockets and threads

2013-04-11 Thread Dexter Deejay
FOUND ERROR! :D In creatin method of thread i wrote treadFunc() and should have said threadFunc (as pointer). Now i have problem with Text component. How to append string at end of it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with sockets and threads

2013-04-11 Thread Dexter Deejay
Thanks for help. Do you have any reference to direct me for that subprocess creation? -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with sockets and threads

2013-04-11 Thread Dexter Deejay
Thanks for help. Do you have any reference to pint me out for that subprocess creation? -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with sockets and threads

2013-04-11 Thread Wayne Werner
On Thu, 11 Apr 2013, Dexter Deejay wrote: Yeah, that seems to be problem. Waiting for message is in theory infinite. But why doesn't this separate thread leave processor while it is sleeping? As far as I've been able to tell? Magic ;) But I haven't really dug into it. If you're really doing

Re: Problems with sockets and threads

2013-04-11 Thread Dexter Deejay
Yeah, that seems to be problem. Waiting for message is in theory infinite. But why doesn't this separate thread leave processor while it is sleeping? -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with sockets and threads

2013-04-11 Thread Wayne Werner
On Thu, 11 Apr 2013, Dexter Deejay wrote: When i try to run this code and to connect to server (server is written in java that part of code is ok) everything stalls. Thread that i created here occupies processor all the time and GUI freezes. It's supposed to be waiting for message from server

Problems with sockets and threads

2013-04-11 Thread Dexter Deejay
When i try to run this code and to connect to server (server is written in java that part of code is ok) everything stalls. Thread that i created here occupies processor all the time and GUI freezes. It's supposed to be waiting for message from server. (asynchronous one) Is there something that

Re: Transparent Proxy and Redirecting Sockets

2013-02-21 Thread Luca Bongiorni
2013/2/21 Rodrick Brown > On Thu, Feb 21, 2013 at 10:24 AM, Luca Bongiorni wrote: > >> Hi all, >> Around I have found plenty useful sources about TCP transparent proxies. >> However I am still missing how to make socket redirection. >> >> What I would like to do is: >> >> host_A <--> PROXY <--> h

Re: Transparent Proxy and Redirecting Sockets

2013-02-21 Thread Rodrick Brown
On Thu, Feb 21, 2013 at 10:24 AM, Luca Bongiorni wrote: > Hi all, > Around I have found plenty useful sources about TCP transparent proxies. > However I am still missing how to make socket redirection. > > What I would like to do is: > > host_A <--> PROXY <--> host_B > ^ >

Transparent Proxy and Redirecting Sockets

2013-02-21 Thread Luca Bongiorni
Hi all, Around I have found plenty useful sources about TCP transparent proxies. However I am still missing how to make socket redirection. What I would like to do is: host_A <--> PROXY <--> host_B ^ | host_C <-- At the beginning the proxy is simply forwarding th

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread peter
Yes, raw sockets need admin privileges, I knew that. The app I'm writing runs as root so that's not a problem. It runs during the %pre script stage of a kickstart controlled install. On Tuesday, January 22, 2013 1:58:07 PM UTC-8, Rob Williscroft wrote: > Try > >

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Rob Williscroft
That's why I was asking about how to do raw sockets, since > tools like dhclient use raw sockets to do what they do. It can clearly > be duplicated in Python, I just need to find some code samples on how > to construct a raw packet. > Try s = socket.socket( socket.AF_INET,

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Peter Steele
> > won't find any good Python examples, and C's all you'll have. Are you > > reasonably familiar with C? > > > > Point to note: Raw sockets *may* require special privileges. Some > > systems require that only root employ them, for security's sake. > > > > ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Chris Angelico
27;s all you'll have. Are you reasonably familiar with C? Point to note: Raw sockets *may* require special privileges. Some systems require that only root employ them, for security's sake. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Peter Steele
> http://www.secdev.org/projects/scapy/ > > > > On Jan 22, 2013 9:17 AM, "Peter Steele" wrote: > > I just tried running you code, and the "sendto" call fails with "Network is > unreachable". That's what I expected, based on othe

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Corey LeBleu
tried running you code, and the "sendto" call fails with "Network > is unreachable". That's what I expected, based on other tests I've done. > That's why I was asking about how to do raw sockets, since tools like > dhclient use raw sockets to do what the

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Peter Steele
I just tried running you code, and the "sendto" call fails with "Network is unreachable". That's what I expected, based on other tests I've done. That's why I was asking about how to do raw sockets, since tools like dhclient use raw sockets to do what they

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Rob Williscroft
this code work if the box has no IP > or default route assigned? I'm away from the office at the moment so I > can't test this. No idea, but the sockets system must be up and running before the card (interface) has an IP (otherwise how would it ever get assigned) and I presume DH

Re: Sending a broadcast message using raw sockets

2013-01-21 Thread Peter Steele
On Monday, January 21, 2013 1:10:06 AM UTC-8, Rob Williscroft wrote: > Peter Steele wrote in > > news:f37ccb35-8439-42cd-a063-962249b44...@googlegroups.com in > > comp.lang.python: > > > I want to write a program in Python that sends a broadcast message > > using

Re: Sending a broadcast message using raw sockets

2013-01-21 Thread Rob Williscroft
Peter Steele wrote in news:f37ccb35-8439-42cd-a063-962249b44...@googlegroups.com in comp.lang.python: > I want to write a program in Python that sends a broadcast message > using raw sockets. The system where this program will run has no IP or > default route defined, hence the reason

Sending a broadcast message using raw sockets

2013-01-18 Thread Peter Steele
I want to write a program in Python that sends a broadcast message using raw sockets. The system where this program will run has no IP or default route defined, hence the reason I need to use a broadcast message. I've done some searches and found some bits and pieces about using raw socket

Re: sockets,threads and interupts

2012-09-05 Thread Bryan
loial wrote: > I have threaded python script that uses sockets to monitor network ports. > > I want to ensure that the socket is closed cleanly in all circumstances. This > includes if the script is killed or interupted in some other way. > > As I understand it signal only

Re: sockets,threads and interupts

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 21:29:12 UTC+5:30, Ramchandra Apte wrote: > On Wednesday, 5 September 2012 18:34:32 UTC+5:30, Chris Angelico wrote: > > > On Wed, Sep 5, 2012 at 10:54 PM, Ramchandra Apte > > wrote: > > > > > > > At least on Linux,

Re: sockets,threads and interupts

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 18:34:32 UTC+5:30, Chris Angelico wrote: > On Wed, Sep 5, 2012 at 10:54 PM, Ramchandra Apte > wrote: > > > At least on Linux, if you kill a process using sockets, it takes about 10 > > seconds for socket to be closed. A program sh

Re: sockets,threads and interupts

2012-09-05 Thread Chris Angelico
On Wed, Sep 5, 2012 at 10:54 PM, Ramchandra Apte wrote: > At least on Linux, if you kill a process using sockets, it takes about 10 > seconds for socket to be closed. A program should try to close all resources. > OS'es may take a long time to close a unclosed socket automatically

Re: sockets,threads and interupts

2012-09-05 Thread Ramchandra Apte
On Wednesday, 5 September 2012 11:26:16 UTC+5:30, Dieter Maurer wrote: > loial writes: > > > > > I have threaded python script that uses sockets to monitor network ports. > > > > > > I want to ensure that the socket is closed cleanly in all circumstances.

Re: sockets,threads and interupts

2012-09-04 Thread Dieter Maurer
loial writes: > I have threaded python script that uses sockets to monitor network ports. > > I want to ensure that the socket is closed cleanly in all circumstances. This > includes if the script is killed or interupted in some other way. The operating system should close

Re: sockets,threads and interupts

2012-09-04 Thread Ramchandra Apte
On Tuesday, 4 September 2012 23:41:13 UTC+5:30, Grant Edwards wrote: > On 2012-09-04, MRAB wrote: > > > On 04/09/2012 16:26, loial wrote: > > >> I have threaded python script that uses sockets to monitor network > > >> ports. > > >> > >

Re: sockets,threads and interupts

2012-09-04 Thread Grant Edwards
On 2012-09-04, MRAB wrote: > On 04/09/2012 16:26, loial wrote: >> I have threaded python script that uses sockets to monitor network >> ports. >> >> I want to ensure that the socket is closed cleanly in all >> circumstances. This includes if the script is killed o

Re: sockets,threads and interupts

2012-09-04 Thread MRAB
On 04/09/2012 16:26, loial wrote: I have threaded python script that uses sockets to monitor network ports. I want to ensure that the socket is closed cleanly in all circumstances. This includes if the script is killed or interupted in some other way. As I understand it signal only works in

sockets,threads and interupts

2012-09-04 Thread loial
I have threaded python script that uses sockets to monitor network ports. I want to ensure that the socket is closed cleanly in all circumstances. This includes if the script is killed or interupted in some other way. As I understand it signal only works in the main thread, so how can I trap

Re: Threads and sockets

2012-08-13 Thread Ulrich Eckhardt
Am 10.08.2012 15:01, schrieb loial: I am writing an application to send data to a printer port(9100) and then recieve PJL responses back on that port. Because of the way PJL works I have to do both in the same process(script). If I understand that right, you are opening a TCP connection, so ob

Re: Threads and sockets

2012-08-10 Thread Grant Edwards
On 2012-08-10, loial wrote: > At the moment I do not start to read responses until the data has > been sent to the printer. However it seems I am missing some > responses from the printer whilst sending the data, so I need to be > able to do the 2 things at the same time. > > Can I open a port on

Re: Threads and sockets

2012-08-10 Thread Dan Stromberg
A select() loop should work. On Fri, Aug 10, 2012 at 1:01 PM, loial wrote: > I am writing an application to send data to a printer port(9100) and then > recieve PJL responses back on that port. Because of the way PJL works I > have to do both in the same process(script). > > At the moment I do n

Re: Threads and sockets

2012-08-10 Thread Dieter Maurer
loial writes: > I am writing an application to send data to a printer port(9100) and then > recieve PJL responses back on that port. Because of the way PJL works I have > to do both in the same process(script). > > At the moment I do not start to read responses until the data has been sent > t

Threads and sockets

2012-08-10 Thread loial
I am writing an application to send data to a printer port(9100) and then recieve PJL responses back on that port. Because of the way PJL works I have to do both in the same process(script). At the moment I do not start to read responses until the data has been sent to the printer. However it s

Re: Sockets accept() in child processes

2012-04-12 Thread Dan Stromberg
On Thu, Apr 12, 2012 at 10:48 AM, Merwin wrote: > Le 12/04/2012 19:10, Dan Stromberg a écrit : > > >> I wonder if this'll do what you need: >> https://trac.calendarserver.**org/browser/CalendarServer/** >> trunk/twext/python/sendfd.py

Re: Sockets accept() in child processes

2012-04-12 Thread Merwin
Le 12/04/2012 19:10, Dan Stromberg a écrit : I wonder if this'll do what you need: https://trac.calendarserver.org/browser/CalendarServer/trunk/twext/python/sendfd.py The problem is that this is Linux-only solution, and I would like to keep a multi-platform compatibility. There are other wa

Re: Sockets accept() in child processes

2012-04-12 Thread Dan Stromberg
le. Here is my current implementation : > > - Main process: select() on a list of server sockets (different ips of the > host, ssl or not, etc) > - Children process : When they get a signal (in fact, a message in a > pipe), they will accept() the server socket > > The problem is tha

Sockets accept() in child processes

2012-04-12 Thread Thibaut DIRLIK
Hi, I'm writing a multiprocess server with Python 3.2 and the multiprocessing module. Here is my current implementation : - Main process: select() on a list of server sockets (different ips of the host, ssl or not, etc) - Children process : When they get a signal (in fact, a message in a

[ANN]: asyncoro: Framework for asynchronous sockets and coroutines

2012-04-05 Thread Giridhar Pemmasani
have same logic as Python programs with synchronous sockets and threads, except for a few syntactic changes. asyncoro supports polling mechanisms epoll, kqueue, /dev/poll (and poll, select if necessary), and Windows I/O Completion Ports (IOCP) for high performance and scalability, and SSL for

Re: icmp and raw sockets in python

2011-12-13 Thread Martin P. Hellwig
On 13/12/2011 16:50, Sagy Drucker wrote: hello Hi i am relatively new to python, so please be considerate... As I am only responding to one of your questions, perhaps it would be best if you don't get any other more helpful replies to split your questions up and post them separately. i'm im

icmp and raw sockets in python

2011-12-13 Thread Sagy Drucker
hello i am relatively new to python, so please be considerate... i'm implementing a server and a client via raw_sockets. i have the necessary privileges. now, the server i defined so: host = socket.gethostbyname(socket.gethostname()) address = (host, 4) sockSer = socket.socket(socket.AF_INET,

Sockets: Receiving C Struct

2011-08-05 Thread Johnny Venter
New to python and would like to test network/sockets with it. I am having a problem where I have setup the following: import socket, sys, struct HOST = '1.1.1.1' PORT = 153 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) data = struct.unpack('!

Re: Sockets: Receiving C Struct

2011-08-05 Thread Dan Stromberg
ship was accepted. > > Please disregard if it's a duplicate. > > Thanks > > Begin forwarded message: > > *From: *Johnny Venter > *Date: *August 5, 2011 8:15:53 AM EDT > *To: *python-list@python.org > *Subject: **Sockets: Receiving C Struct* > > New to python a

Fwd: Sockets: Receiving C Struct

2011-08-05 Thread Johnny Venter
I was not sure if this message was sent before my membership was accepted. Please disregard if it's a duplicate. Thanks Begin forwarded message: > From: Johnny Venter > Date: August 5, 2011 8:15:53 AM EDT > To: python-list@python.org > Subject: Sockets: Receiving C Struct &

Re: sockets: bind to external interface

2011-04-26 Thread Jean-Michel Pichavant
Hans Georg Schaathun wrote: Is there a simple way to find the external interface and bind a socket to it, when the hostname returned by socket.gethostname() maps to localhost? What seems to be the standard ubuntu configuration lists the local hostname with 127.0.0.1 in /etc/hosts. (I checked th

Re: sockets: bind to external interface

2011-04-25 Thread Hans Georg Schaathun
On Mon, 25 Apr 2011 23:18:05 +0200, Thomas Rachel wrote: : That is right, but I cannot see where he mentions the "direction" of the : socket. My fist thought was that he tries to have a server socket... Quite right. I thought it was implied by the need to bind :-) Sorry for the lack of deta

Re: sockets: bind to external interface

2011-04-25 Thread Chris Angelico
bind/listen/accept, and the classic TCP client has just >> connect; bind/connect is a lot less common. > > That is right, but I cannot see where he mentions the "direction" of the > socket. My fist thought was that he tries to have a server socket... > > (BTW: bind ca

Re: sockets: bind to external interface

2011-04-25 Thread Thomas Rachel
common. That is right, but I cannot see where he mentions the "direction" of the socket. My fist thought was that he tries to have a server socket... (BTW: bind can be omitted on server sockets as well; listen() seems to includes a bind(('', 0)) if not called explicitly

Re: sockets: bind to external interface

2011-04-25 Thread Thomas Rachel
Am 25.04.2011 22:14 schrieb Hans Georg Schaathun: On Tue, 26 Apr 2011 05:49:07 +1000, Chris Angelico wrote: : The way you talk of "the" external interface, I'm assuming this : computer has only one. Is there a reason for not simply binding to : INADDR_ANY aka 0.0.0.0? Ah. That's wha

Re: sockets: bind to external interface

2011-04-25 Thread Chris Angelico
ologies - I've done most of my sockets programming in C, where the integer constant is applicable. 0.0.0.0 means the exact same thing. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   >