Re: sockets: bind to external interface

2011-04-25 Thread Chris Angelico
On Tue, Apr 26, 2011 at 6:14 AM, Hans Georg Schaathun 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 what I really wanted.  Thanks a lot.  I wonder why

Re: sockets: bind to external interface

2011-04-25 Thread Hans Georg Schaathun
On Mon, 25 Apr 2011 21:14:51 +0100, Hans Georg Schaathun 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 what I really wanted. Thanks a lot. I wond

Re: sockets: bind to external interface

2011-04-25 Thread Hans Georg Schaathun
On Tue, 26 Apr 2011 05:49:07 +1000, Chris Angelico wrote: : You can run 'ifconfig' without being root, so there must be a way. At : very worst, parse ifconfig's output. Of course, but I am not sure that's simpler than the manual solution. Especially since there is more than one version of ifc

Re: sockets: bind to external interface

2011-04-25 Thread Jean-Paul Calderone
On Apr 25, 3:49 pm, Chris Angelico wrote: > On Tue, Apr 26, 2011 at 5:37 AM, Hans Georg Schaathun > wrote: > > > Has anyone found a simple solution that can be administered without > > root privileges?  I mean simpler than passing the ip address > > manually :-) > > You can run 'ifconfig' withou

Re: sockets: bind to external interface

2011-04-25 Thread Chris Angelico
On Tue, Apr 26, 2011 at 5:37 AM, Hans Georg Schaathun wrote: > Has anyone found a simple solution that can be administered without > root privileges?  I mean simpler than passing the ip address > manually :-) You can run 'ifconfig' without being root, so there must be a way. At very worst, parse

sockets: bind to external interface

2011-04-25 Thread Hans Georg Schaathun
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 this on two ubuntu boxen, on onl

Re: Sending pictures using sockets

2011-04-06 Thread Dan Stromberg
On Wed, Apr 6, 2011 at 4:17 PM, Littlefield, Tyler wrote: > On 4/6/2011 4:58 PM, craf wrote: > >> >Hello. >> > >> >I'm testing the sockets in Python and I've seen the way in which >> >works to send string. My question is if anyone knows where &

Re: Sending pictures using sockets

2011-04-06 Thread Littlefield, Tyler
On 4/6/2011 4:58 PM, craf wrote: >Hello. > >I'm testing the sockets in Python and I've seen the way in which >works to send string. My question is if anyone knows where >can find some information on how to send pictures through >Sockets. I use Python 2.7 and have re

Sending pictures using sockets

2011-04-06 Thread craf
Hello. I'm testing the sockets in Python and I've seen the way in which works to send string. My question is if anyone knows where can find some information on how to send pictures through Sockets. I use Python 2.7 and have read the information regarding Sockets of the Python website,

Re: PostgreSQL vs MySQL (was Re: How to handle sockets - easily?)

2011-03-17 Thread J Peyret
On Mar 16, 10:19 am, a...@pythoncraft.com (Aahz) wrote: > In article , > >always recommend people to use PostgreSQL, though; which is superior in > >almost every way, especially the C client library and the wire protocol.) > > Can you point at a reference for the latter?  I have been trying to > c

Re: creating RAW sockets

2011-03-17 Thread moijes12
On Mar 18, 6:20 am, Nobody wrote: > On Wed, 16 Mar 2011 23:50:03 -0700, moijes12 wrote: > > Now,please can someone guide(as in what should I read and NOT as in > > give me the code) me in decoding the IP header of packets using python > > 3.0.1. > > The "struct" module is the usual approach for de

Re: creating RAW sockets

2011-03-17 Thread Nobody
On Wed, 16 Mar 2011 23:50:03 -0700, moijes12 wrote: > Now,please can someone guide(as in what should I read and NOT as in > give me the code) me in decoding the IP header of packets using python > 3.0.1. The "struct" module is the usual approach for decoding binary data structures. Fields which a

Re: creating RAW sockets

2011-03-16 Thread moijes12
On Mar 17, 11:28 am, moijes12 wrote: > On Mar 17, 11:14 am, Nobody wrote: > > > On Wed, 16 Mar 2011 22:36:07 -0700, moijes12 wrote: > > > Traceback (most recent call last): > > >   File "getsockopt_handler.py", line 7, in ? > > >     send.bind((gethostbyname(gethostname()),5)) > > > socket.er

Re: creating RAW sockets

2011-03-16 Thread moijes12
On Mar 17, 11:14 am, Nobody wrote: > On Wed, 16 Mar 2011 22:36:07 -0700, moijes12 wrote: > > Traceback (most recent call last): > >   File "getsockopt_handler.py", line 7, in ? > >     send.bind((gethostbyname(gethostname()),5)) > > socket.error: (99, 'Cannot assign requested address') > > Spe

Re: creating RAW sockets

2011-03-16 Thread Nobody
On Wed, 16 Mar 2011 22:36:07 -0700, moijes12 wrote: > Traceback (most recent call last): > File "getsockopt_handler.py", line 7, in ? > send.bind((gethostbyname(gethostname()),5)) > socket.error: (99, 'Cannot assign requested address') Specifying a port number isn't meaningful for a raw

Re: creating RAW sockets

2011-03-16 Thread Chris Rebert
On Wed, Mar 16, 2011 at 10:36 PM, moijes12 wrote: > Hi > > I am unable to create RAW sockets using python. > > Traceback (most recent call last): >  File "getsockopt_handler.py", line 6, in ? >    send = socket(AF_INET,SOCK_RAW,IPPROTO_IP) > socket.erro

creating RAW sockets

2011-03-16 Thread moijes12
Hi I am unable to create RAW sockets using python. Traceback (most recent call last): File "getsockopt_handler.py", line 6, in ? send = socket(AF_INET,SOCK_RAW,IPPROTO_IP) socket.error: (94, 'Socket type not supported') I've tried changing the type from IPPROTO_IP

PostgreSQL vs MySQL (was Re: How to handle sockets - easily?)

2011-03-16 Thread Aahz
In article , William Ahern wrote: > >I think that there's an asynchronous all-Python MySQL library, but I'm not >sure. Maybe one day I can open source my asynchronous MySQL C library. (I >always recommend people to use PostgreSQL, though; which is superior in >almost every way, especially the C c

Re: How to handle sockets - easily?

2011-02-16 Thread William Ahern
Bubba wrote: > William Ahern's log on stardate 16 vlj 2011 > /snip > > I think that there's an asynchronous all-Python MySQL library, but > > I'm not sure. Maybe one day I can open source my asynchronous MySQL C > > library. (I always recommend people to use PostgreSQL, though; which > > is supe

Re: How to handle sockets - easily?

2011-02-16 Thread Jean-Paul Calderone
r('', 2020) > > asyncore.loop() > > > > I do, however, have some more questions (thus crosspost to > > comp.lang.python) - how many connections can this server handle without > > a problem? I'm using Asyncore module, as it can be seen. > > Is it neces

Re: How to handle sockets - easily?

2011-02-16 Thread Bubba
William Ahern's log on stardate 16 vlj 2011 /snip > I think that there's an asynchronous all-Python MySQL library, but > I'm not sure. Maybe one day I can open source my asynchronous MySQL C > library. (I always recommend people to use PostgreSQL, though; which > is superior in almost every way,

Re: How to handle sockets - easily?

2011-02-16 Thread William Ahern
#x27;m using Asyncore module, as it can be seen. > Is it necessary, due to the fact that it should serve more than > thousand devices that send data every 10 seconds, to do threading (I > believe that is already done with Asyncore for sockets, but what about > SQL?) The MySQL C librar

Re: How to handle sockets - easily?

2011-02-16 Thread Bubba
not parse data, but rather put the whole payload to SQL database, which would be parsed afterwards. This code takes almost twice LOC less that C code. I do, however, have some more questions (thus crosspost to comp.lang.python) - how many connections can this server handle withou

Re: udp sockets with python

2010-11-11 Thread r0g
On 11/11/10 16:03, Jean-Paul Calderone wrote: On Nov 10, 9:23 pm, Tim Roberts wrote: Mag Gam wrote: I am measuring the round trip time using tcpdump. The C version is giving me around 80 microseconds (average) and the python is giving me close to 300 microseconds (average). If you need the

Re: udp sockets with python

2010-11-11 Thread Jean-Paul Calderone
On Nov 10, 9:23 pm, Tim Roberts wrote: > Mag Gam wrote: > > >I am measuring the round trip time using tcpdump. The C version is > >giving me around 80 microseconds (average) and the python is giving me > >close to 300 microseconds (average). > > If you need the performance of a compiled language,

Re: udp sockets with python

2010-11-10 Thread Tim Roberts
Mag Gam wrote: > >I am measuring the round trip time using tcpdump. The C version is >giving me around 80 microseconds (average) and the python is giving me >close to 300 microseconds (average). If you need the performance of a compiled language, then it's probably not appropriate to use an inter

Re: udp sockets with python

2010-11-09 Thread Jean-Paul Calderone
On Nov 9, 5:20 am, Mag Gam wrote: > Hello, > > When measuring round trip time for the UDP echo client/server the C > version is much faster. I was wondering if there is anything I can do > to speed up. > > My current code for client looks like this > > sock=socket(AF_INET,SOCK_DGRAM) > for x i

udp sockets with python

2010-11-09 Thread Mag Gam
Hello, When measuring round trip time for the UDP echo client/server the C version is much faster. I was wondering if there is anything I can do to speed up. My current code for client looks like this sock=socket(AF_INET,SOCK_DGRAM) for x in range (1000): sock.sendto("foo",(server,port))

Python, Windows, and file sockets

2010-10-13 Thread culix
Hey list, I have a question about unix-style file sockets and/or named pipes with python. I have a linux server program that uses a file socket to listen for connections. It has been ported to Windows with cygwin (I'm running WinXP SP3). On linux I have a python script that acts as a client

Re: Determine sockets in use by python

2010-10-01 Thread Antoine Pitrou
re is some way to promote a c socket to a python socket > object. > > Appreciate the info, folks. You can also try to monkeypatch the socket module (before importing the 3rd-party library) and replace the socket.socket() constructor with a custom one which tracks all created sockets in

Re: Determine sockets in use by python

2010-09-30 Thread exarkun
e the socket to the script level, >> and the developer recommends a busy loop: >> while True: >> � � sleep(1) >> � � process_event() >> which I hope to avoid, for many reasons.  If the socket can be exposed >> to the script level, then the problem w

Re: Determine sockets in use by python

2010-09-30 Thread Jim Mellander
ent() >> >> >> Unfortunately, the API does not expose the socket to the script level, >> >> and the developer recommends a busy loop: >> >> >> while True: >> >>     sleep(1) >> >>     process_event() >> >> >>

Re: Determine sockets in use by python

2010-09-30 Thread Jean-Paul Calderone
sy loop: > > >> while True: > >>     sleep(1) > >>     process_event() > > >> which I hope to avoid, for many reasons.  If the socket can be exposed > >> to the script level, then the problem would be solved. > > >> Failing that, it wo

Re: Determine sockets in use by python

2010-09-29 Thread Jim Mellander
If the socket can be exposed >> to the script level, then the problem would be solved. >> >> Failing that, it would be nice to be able to pythonically determine >> the sockets in use and select on those.  Does anyone have any >> suggestions on how to proceed? >&g

Re: Determine sockets in use by python

2010-09-29 Thread Gary Herron
busy loop: while True: sleep(1) process_event() which I hope to avoid, for many reasons. If the socket can be exposed to the script level, then the problem would be solved. Failing that, it would be nice to be able to pythonically determine the sockets in use and select on those.

Determine sockets in use by python

2010-09-29 Thread Jim Mellander
eep(1) process_event() which I hope to avoid, for many reasons. If the socket can be exposed to the script level, then the problem would be solved. Failing that, it would be nice to be able to pythonically determine the sockets in use and select on those. Does anyone have any suggestions on how to proceed? T

Re: Raw Sockets - IP-Encapsulation

2010-09-27 Thread Alexander Gattin
I could > > create a GRE tunnel) > > > > The thing is, I just don't understand how I > > such a socket could be created and then later > > on handled. > > You don't create sockets for IPPROTO_IPIP or > IPPROTO_GRE. Outside of the kernel, those >

Re: Raw Sockets - IP-Encapsulation

2010-09-24 Thread Nobody
ch a socket could be > created and then later on handled. You don't create sockets for IPPROTO_IPIP or IPPROTO_GRE. Outside of the kernel, those identifiers are only likely to be used for specifying protocols when e.g. configuring packet filtering. Tunnelling only involves user-space for

Raw Sockets - IP-Encapsulation

2010-09-24 Thread Matthias Guentert
set the fields? How do I really encapsulate other data (=sockets?)? Do I need a Raw socket at all? Or should this work somehow like the following to encapsulate UDP payload? s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_IPIP) I really would be happy if someone could help me with

Raw Sockets - IP-Encapsulation

2010-09-23 Thread Matthias Guentert
set the fields? How do I really encapsulate other data (=sockets?)? Do I need a Raw socket at all? Or should this work somehow like the following to encapsulate UDP payload? s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_IPIP) I really would be happy if someone could help me with

Re: Sending HTTP headers via plain sockets

2010-07-22 Thread MRAB
to send HTTP headers for redirection using sockets in python 3, but in vain. If I use the meta tag REFRESH method the redirection works. Please advise what I am missing, below is the snippet of my code: hostsock is the socket object print('Redirecting client') hosts

Re: Sending HTTP headers via plain sockets

2010-07-22 Thread Navkirat Singh
On 23-Jul-2010, at 7:00 AM, Navkirat Singh wrote: Hi Guys, I am very new to python and I am trying to send HTTP headers for redirection using sockets in python 3, but in vain. If I use the meta tag REFRESH method the redirection works. Please advise what I am missing, below is the snippet

Sending HTTP headers via plain sockets

2010-07-22 Thread Navkirat Singh
Hi Guys, I am very new to python and I am trying to send HTTP headers for redirection using sockets in python 3, but in vain. If I use the meta tag REFRESH method the redirection works. Please advise what I am missing, below is the snippet of my code: hostsock is the socket object

Re: Sockets and xml problem

2010-05-28 Thread kak...@gmail.com
On May 28, 3:23 pm, Stefan Behnel wrote: > kak...@gmail.com, 28.05.2010 13:50: > > > Hi in the following code > > > class MyClientHandler(SocketServer.BaseRequestHandler): > >      def handle(self): > >          print self.client_address, now( ) > >          time.sleep(5) > >          while True:

Re: Sockets and xml problem

2010-05-28 Thread Stefan Behnel
kak...@gmail.com, 28.05.2010 13:50: Hi in the following code class MyClientHandler(SocketServer.BaseRequestHandler): def handle(self): print self.client_address, now( ) time.sleep(5) while True: xmltxt = self.request.recv(1024)<--is this ok - enough?

Sockets and xml problem

2010-05-28 Thread kak...@gmail.com
Hi in the following code class MyClientHandler(SocketServer.BaseRequestHandler): def handle(self): print self.client_address, now( ) time.sleep(5) while True: xmltxt = self.request.recv(1024)<--is this ok - enough? if not xmltxt: break

[BarCamp] WebWorkersCamp BarCamp: NodeJS, NoSQL, Message Queues, Asynchronous programming, Web Sockets, Distributed Applications, Decentralized Social Networks, buzzword generators...

2010-05-17 Thread Pierre
Hello, AF83 will be holding a barcamp event on Saturday afternoon, July 3rd in Paris (in La Cantine, a famous Parisian tech place). We wanted to let you know about this event and tell you that you would be most welcome if you could join us on that day. In the ever-growing context of real-time web

Re: Sockets and threading

2009-07-12 Thread Piet van Oostrum
> zayatzz (z) wrote: >z> Im trying to get aquinted to python on bit more basic level and am >z> following socket and threading programming tutorials from these 2 >z> addresses : >z> http://heather.cs.ucdavis.edu/~matloff/Python/PyNet.pdf >z> http://heather.cs.ucdavis.edu/~matloff/Python/PyTh

Re: Sockets and threading

2009-07-12 Thread Gabriel Genellina
En Sun, 12 Jul 2009 16:16:29 -0300, zayatzz escribió: while 1: k = self.myclntsock.recv(1) if k == "": break srvr.vlock.acquire() srvr.v += k srvr.vlock.releas

Sockets and threading

2009-07-12 Thread zayatzz
Im trying to get aquinted to python on bit more basic level and am following socket and threading programming tutorials from these 2 addresses : http://heather.cs.ucdavis.edu/~matloff/Python/PyNet.pdf http://heather.cs.ucdavis.edu/~matloff/Python/PyThreads.pdf in this PyThreads file he sets up th

Re: Help with Sockets.

2009-07-05 Thread Gabriel Genellina
En Sun, 05 Jul 2009 23:06:30 -0300, tanner barnes escribió: I am writing a program and in one section there is going to be a lobby with (for testing purposes) about 4 people in it. in the lobby there are two txtctrl's the first for entering your message and the second for displaying the

Help with Sockets.

2009-07-05 Thread tanner barnes
I am writing a program and in one section there is going to be a lobby with (for testing purposes) about 4 people in it. in the lobby there are two txtctrl's the first for entering your message and the second for displaying the message you and the other people in the lobby type. i am trying to

Re: problem with sockets and transferring binary files

2009-06-02 Thread thebiggestbangtheory
On Jun 2, 10:29 pm, "Gabriel Genellina" wrote: > En Wed, 03 Jun 2009 01:54:02 -0300,   > escribió: > > >            I am a python newbie. I am now progressing to writing a > > network app in python to learn more about it. [...] > > Surprisingly, the sha1 hash of the encrypted data before it is se

Re: problem with sockets and transferring binary files

2009-06-02 Thread Gabriel Genellina
En Wed, 03 Jun 2009 01:54:02 -0300, escribió: I am a python newbie. I am now progressing to writing a network app in python to learn more about it. [...] Surprisingly, the sha1 hash of the encrypted data before it is sent from server is different from the encrypted file data recei

problem with sockets and transferring binary files

2009-06-02 Thread thebiggestbangtheory
Dear all, I am a python newbie. I am now progressing to writing a network app in python to learn more about it. I have a client and a server in python. The client sends a msg to the server asking it to tar a binary .dbxml file and then send it over to it. The steps are: from the 1. Clien

Re: UDP reading on multiple sockets

2009-05-22 Thread Lawrence D'Oliveiro
examples of using select together with sockets available? select is easy to use. In Python, you just pass it three lists of file-like objects (anything that implements fileno in the way described in the docs), together with an optional timeout. It will return three corresponding lists, bein

Re: UDP reading on multiple sockets

2009-05-19 Thread Gabriel Rossetti
thomas.vo...@likeabird.de wrote: On 17 Mai, 04:22, Grant Edwards wrote: On 2009-05-17, Thomas Vogel wrote: I'm currently have the problem that I try to read UDP messages from multiple sockets in parallel. So let's say I get UDP packets from the same IP on the ports 2000,

Re: UDP reading on multiple sockets

2009-05-19 Thread Steve Howell
On May 18, 6:19 am, thomas.vo...@likeabird.de wrote: > On 17 Mai, 04:22, Grant Edwards wrote: > > > On 2009-05-17, Thomas Vogel wrote: > > > > I'm currently have the problem that I try to read UDP messages from > > > multiple sockets in parallel. S

Re: UDP reading on multiple sockets

2009-05-19 Thread Jean-Paul Calderone
On Mon, 18 May 2009 06:19:01 -0700 (PDT), thomas.vo...@likeabird.de wrote: On 17 Mai, 04:22, Grant Edwards wrote: On 2009-05-17, Thomas Vogel wrote: > I'm currently have the problem that I try to read UDP messages from > multiple sockets in parallel. So let's say I get UDP

Re: UDP reading on multiple sockets

2009-05-19 Thread Grant Edwards
On 2009-05-18, thomas.vo...@likeabird.de wrote: > On 17 Mai, 04:22, Grant Edwards wrote: >> On 2009-05-17, Thomas Vogel wrote: >> >> > I'm currently have the problem that I try to read UDP messages from >> > multiple sockets in parallel. So let's say

Re: UDP reading on multiple sockets

2009-05-19 Thread Guido Goldstein
Hi! On Mon, 18 May 2009 06:19:01 -0700 (PDT) thomas.vo...@likeabird.de wrote: [...] > The only honest answer would be that I'm totaly unfamiliar with select > and also the documentation I found wasn't able to clear the picture. > So are there examples of using select to

Re: UDP reading on multiple sockets

2009-05-19 Thread thomas . vogel
On 17 Mai, 04:22, Grant Edwards wrote: > On 2009-05-17, Thomas Vogel wrote: > > > I'm currently have the problem that I try to read UDP messages from > > multiple sockets in parallel. So let's say I get UDP packets from the > > same IP on the ports 2000, 2001

Re: UDP reading on multiple sockets

2009-05-16 Thread Grant Edwards
On 2009-05-17, Thomas Vogel wrote: > I'm currently have the problem that I try to read UDP messages from > multiple sockets in parallel. So let's say I get UDP packets from the > same IP on the ports 2000, 2001, 2002,... Is there any reason you can't do it the easy wa

UDP reading on multiple sockets

2009-05-16 Thread Thomas Vogel
Hi all, I'm currently have the problem that I try to read UDP messages from multiple sockets in parallel. So let's say I get UDP packets from the same IP on the ports 2000, 2001, 2002,... Therefore I created the following class. But if I try to instantiate it several times with

Re: Sending directory with files in it via sockets

2009-04-17 Thread MRAB
Ryniek90 wrote: Hi. Last time i've got problem with sending big files, but i've already dealt with it. Now, when i want send directory (with some files in it) i iterate that directory for files in it, and then in while loop open iterated files, read them and send. But something's not working.

Sending directory with files in it via sockets

2009-04-17 Thread Ryniek90
Hi. Last time i've got problem with sending big files, but i've already dealt with it. Now, when i want send directory (with some files in it) i iterate that directory for files in it, and then in while loop open iterated files, read them and send. But something's not working. It iterate's firs

Re: How to stop subprocesses from copying listening sockets

2008-12-25 Thread Rick van Hattem
On Friday 26 December 2008 04:05:43 Roy Smith wrote: > In article , > > Rick van Hattem wrote: > > Recently I've started building a program that spawns new processes when > > requested via http, since the http interface doesn't need to be fancy > > I've just used the BaseHTTPServer module for thi

Re: How to stop subprocesses from copying listening sockets

2008-12-25 Thread Roy Smith
In article , Rick van Hattem wrote: > Recently I've started building a program that spawns new processes when > requested via http, since the http interface doesn't need to be fancy I've > just used the BaseHTTPServer module for this, but... it seems I'm running > into a little problem. When

How to stop subprocesses from copying listening sockets

2008-12-25 Thread Rick van Hattem
Hi everyone, Recently I've started building a program that spawns new processes when requested via http, since the http interface doesn't need to be fancy I've just used the BaseHTTPServer module for this, but... it seems I'm running into a little problem. When spawning a new process (which for

Re: Transferring a file over sockets

2008-12-17 Thread MRAB
Hendrik van Rooyen wrote: Ferdinand Sousa wrote: == .# file receiver # work in progress import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) HOST = '192.168.1.17' PORT = 31400 s.bind((HOST, PORT)) s.listen(3) conn, add

Re: Transferring a file over sockets

2008-12-17 Thread Hendrik van Rooyen
Ferdinand Sousa wrote: >== .# file receiver ># work in progress > >import socket > >s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >HOST = '192.168.1.17' >PORT = 31400 > >s.bind((HOST, PORT)) >s.listen(3) >conn, addr = s.accept() >pr

Re: Transferring a file over sockets

2008-12-17 Thread Jean-Paul Calderone
On Wed, 17 Dec 2008 17:41:46 +0530, Ferdinand Sousa wrote: I am using sockets to transfer a file over LAN. There are 2 scripts, the server opens a listens for connection and the client is run on another machine. I always make sure the server is run first. The strange thing is that if the the

Re: Transferring a file over sockets

2008-12-17 Thread Tim Golden
Ferdinand Sousa wrote: I am using sockets to transfer a file over LAN. There are 2 scripts, the server opens a listens for connection and the client is run on another machine. I always make sure the server is run first. The strange thing is that if the the server script is double-clicked and

Transferring a file over sockets

2008-12-17 Thread Ferdinand Sousa
I am using sockets to transfer a file over LAN. There are 2 scripts, the server opens a listens for connection and the client is run on another machine. I always make sure the server is run first. The strange thing is that if the the server script is double-clicked and executed (run in a console

Wierd problem with python sockets and threading

2008-10-20 Thread thrthr
I have two python "applications" (more like scripts, they're only about 80 lines each) that are dumbed down http-servers: They accept a connection, reads everything in the socket untill "\r\n\r\n" and then responds with "HTTP/1.1 200 OK\r\n\r\nHello World!" and then closes the connection. There is

Re: problem with sockets code

2008-10-05 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In message > <[EMAIL PROTECTED]>, Daniel > wrote: > > > while data: > > ... > > data = self.rfile.readline().strip() > > Interpreting a random string value as a Boolean is a bad idea

Re: problem with sockets code

2008-10-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Daniel wrote: > while data: > ... > data = self.rfile.readline().strip() Interpreting a random string value as a Boolean is a bad idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with sockets code

2008-10-02 Thread James Mills
On Fri, Oct 3, 2008 at 2:13 AM, Daniel <[EMAIL PROTECTED]> wrote: > Hello, > > I can't seem to get my sockets code to work right. Here is what I > have inside my RequestHandler handle() function: > >total_data=[] > >data = True >logge

problem with sockets code

2008-10-02 Thread Daniel
Hello, I can't seem to get my sockets code to work right. Here is what I have inside my RequestHandler handle() function: total_data=[] data = True logger_server.debug(self.__class__.__name__ + ' set data = True') while data: logger_se

Re: problem with "ImportError: No module named..." and sockets

2008-10-01 Thread Daniel
On Sep 30, 5:49 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 30 Sep 2008 19:44:51 -0300, Daniel <[EMAIL PROTECTED]>   > escribió: > > > > > On Sep 30, 4:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > > wrote: > >> En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <[EMAIL PROTECTED]>   >

Re: problem with "ImportError: No module named..." and sockets

2008-09-30 Thread Gabriel Genellina
En Tue, 30 Sep 2008 19:44:51 -0300, Daniel <[EMAIL PROTECTED]> escribió: On Sep 30, 4:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <[EMAIL PROTECTED]>   escribió: > [BEGIN CODE] > #!/usr/bin/python > import SocketServer > import os, sys > n

Re: problem with "ImportError: No module named..." and sockets

2008-09-30 Thread Daniel
On Sep 30, 4:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <[EMAIL PROTECTED]>   > escribió: > > > > > [BEGIN CODE] > > #!/usr/bin/python > > import SocketServer > > import os, sys > > newpath = os.path.normpath( os.path.join( __file__, "../../..

Re: problem with "ImportError: No module named..." and sockets

2008-09-30 Thread Gabriel Genellina
En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <[EMAIL PROTECTED]> escribió: [BEGIN CODE] #!/usr/bin/python import SocketServer import os, sys newpath = os.path.normpath( os.path.join( __file__, "../../.." )) sys.path.insert(0, newpath) from pop.command.UpdateCommand import * import cPickle Tra

problem with "ImportError: No module named..." and sockets

2008-09-30 Thread Daniel
Hello, I'm trying to build a very simple IPC system. What I have done is create Data Transfer Objects (DTO) for each item I'd like to send across the wire. I am serializing these using cPickle. I've also tried using pickle (instead of cPickle), but I get the same response. Below is the code.

Re: Twisted vs Python Sockets

2008-09-19 Thread Michael Palmer
On Sep 18, 4:24 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > James Matthews wrote: > > I am wondering what are the major points of twisted over regular python > > sockets. I am looking to write a TCP server and want to know the pros > > can cons of using one over

Re: Twisted vs Python Sockets

2008-09-18 Thread James Mills
On Fri, Sep 19, 2008 at 6:24 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > James Matthews wrote: > >> I am wondering what are the major points of twisted over regular python >> sockets. I am looking to write a TCP server and want to know the pros can >> co

Re: Twisted vs Python Sockets

2008-09-18 Thread Fredrik Lundh
James Matthews wrote: I am wondering what are the major points of twisted over regular python sockets. I am looking to write a TCP server and want to know the pros can cons of using one over the other. Twisted is a communication framework with lots of ready-made components: http

Twisted vs Python Sockets

2008-09-18 Thread James Matthews
Hi I am wondering what are the major points of twisted over regular python sockets. I am looking to write a TCP server and want to know the pros can cons of using one over the other. Thanks James -- http://www.goldwatches.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python sockets UDP broadcast multicast question??

2008-08-28 Thread castironpi
On Aug 28, 1:09 am, inorlando <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a question about python and sockets , UDP datagram in > particular. I'm new to socket programming so please bare with me. > > I am trying to write a simple application that broadcast files

Re: Python sockets UDP broadcast multicast question??

2008-08-28 Thread inorlando
On Aug 28, 8:06 am, Francesco Bochicchio <[EMAIL PROTECTED]> wrote: > On 28 Ago, 08:09, inorlando <[EMAIL PROTECTED]> wrote: > > > > > Hi all, > > > I have a question about python and sockets , UDP datagram in > > particular. I'm new to socket pro

Re: Python sockets UDP broadcast multicast question??

2008-08-28 Thread Francesco Bochicchio
On 28 Ago, 08:09, inorlando <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a question about python and sockets , UDP datagram in > particular. I'm new to socket programming so please bare with me. > > I am trying to write a simple application that broadcast files to &

Python sockets UDP broadcast multicast question??

2008-08-27 Thread inorlando
Hi all, I have a question about python and sockets , UDP datagram in particular. I'm new to socket programming so please bare with me. I am trying to write a simple application that broadcast files to another computer on the same network/subnet but I do not want the receiver computer to ha

Re: Urllib(1/2) how to open multiple client sockets?

2008-06-26 Thread MRAB
On Jun 26, 11:48 am, ShashiGowda <[EMAIL PROTECTED]> wrote: > Hey there i made a script to download all images from a web site but > it runs damn slow though I have a lot of bandwidth waiting to be used > please tell me a way to use urllib to open many connections to the > server to download many p

Re: Urllib(1/2) how to open multiple client sockets?

2008-06-26 Thread Gerhard Häring
ShashiGowda wrote: Hey there i made a script to download all images from a web site but it runs damn slow though I have a lot of bandwidth waiting to be used please tell me a way to use urllib to open many connections to the server to download many pics simultaneously Any off question suggest

Urllib(1/2) how to open multiple client sockets?

2008-06-26 Thread ShashiGowda
Hey there i made a script to download all images from a web site but it runs damn slow though I have a lot of bandwidth waiting to be used please tell me a way to use urllib to open many connections to the server to download many pics simultaneously Any off question suggestions are also ok... -

Re: testing client-server sockets

2008-04-18 Thread Astan Chee
Wierd. It works now. I must've changed something. Oh well, thanks anyway. David Harrison wrote: On 18/04/2008, Astan Chee <[EMAIL PROTECTED]> wrote: Server code: import os, sys, socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = '' port = 5602 s.bind((host,port)) try

Re: testing client-server sockets

2008-04-18 Thread David Harrison
On 18/04/2008, Astan Chee <[EMAIL PROTECTED]> wrote: > Server code: > > import os, sys, socket > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > host = '' > port = 5602 > s.bind((host,port)) > try: > s.listen(1) > while 1: > conn, addr = s.accept() > print

Re: testing client-server sockets

2008-04-18 Thread Astan Chee
Server code: import os, sys, socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = '' port = 5602 s.bind((host,port)) try: s.listen(1) while 1: conn, addr = s.accept() print 'client is at', addr data = conn.recv(100) data = data * 10 z =

Re: testing client-server sockets

2008-04-18 Thread David Harrison
On 18/04/2008, Astan Chee <[EMAIL PROTECTED]> wrote: > Hi, > I have a client-server socket script in python. Something like this > http://ubuntuforums.org/showthread.php?t=208962 > Now the problem I have is that I want to try to connect the client to > the server on the same machine, but it giv

testing client-server sockets

2008-04-18 Thread Astan Chee
Hi, I have a client-server socket script in python. Something like this http://ubuntuforums.org/showthread.php?t=208962 Now the problem I have is that I want to try to connect the client to the server on the same machine, but it gives me a 'port already in use' error. I just want the client to c

<    1   2   3   4   5   6   >