Re: Sockets on Windows and Mac

2006-01-09 Thread rodmc
Hi Peter, I am currently importing the socket library when I write the programs, I have had no problems with it on my PC at work, but the Mac at home steadfastly refuses to work. As for existing libraries, I am new to Python so am kean to avoid re-inventing the wheel :-) Cheers, rod -- http://

Re: Sockets on Windows and Mac

2006-01-09 Thread rodmc
I am on 10.3, I keep getting exceptions when it hits lines like mySocket.bind (SERVER_IP, 2727 ) or mySocket = socket.socket(socket.AF_NET,socket.SOCK_STREAM) The code I am using is copied from a tutorial on a website somewhere. Cheers, rod -- http://mail.python.org/mailman/listinfo/python-li

Re: Sockets on Windows and Mac

2006-01-09 Thread rodmc
Hi Peter, I am currently importing the socket library when I write the programs, I have had no problems with it on my PC at work, but the Mac at home steadfastly refuses to work. As for existing libraries, I am new to Python so am kean to avoid re-inventing the wheel :-) Cheers, rod -- http://

Re: Sockets on Windows and Mac

2006-01-08 Thread Alex Martelli
rodmc <[EMAIL PROTECTED]> wrote: > I am new to Python and have been writing some socket based programmes > on Windows (with some success), however I am unable to get them to work > on Mac. > > Are there differences in the way the socket module works on Windows and > Mac? I would appreciate any si

Re: Sockets on Windows and Mac

2006-01-08 Thread Peter Hansen
rodmc wrote: > I am new to Python and have been writing some socket based programmes > on Windows (with some success), however I am unable to get them to work > on Mac. > > Are there differences in the way the socket module works on Windows and > Mac? I would appreciate any simple code samples peo

Re: Sockets on Windows and Mac

2006-01-08 Thread Irmen de Jong
rodmc wrote: > I am new to Python and have been writing some socket based programmes > on Windows (with some success), however I am unable to get them to work > on Mac. Please elaborate on "unable to get them to work". What problems do you see? In my experience, there is no difference with the Ma

Sockets on Windows and Mac

2006-01-08 Thread rodmc
I am new to Python and have been writing some socket based programmes on Windows (with some success), however I am unable to get them to work on Mac. Are there differences in the way the socket module works on Windows and Mac? I would appreciate any simple code samples people my have for creating

Re: IRC sockets and queries

2006-01-03 Thread Thomas Wouters
On Fri, 30 Dec 2005 16:17:01 -0800, Jay wrote: > LMFAO! those were jokes for my friends. lol.and btw the dccpoper and > bot and crap were jokes that i made up for my friends on the #python > channel in freenode... It was a joke. Yet no one on the channel thought it was funny. It got you kicked an

Re: IRC sockets and queries

2005-12-30 Thread J4Y
kk -- http://mail.python.org/mailman/listinfo/python-list

Re: IRC sockets and queries

2005-12-30 Thread Heiko Wundram
Heiko Wundram wrote: > Yeah, me too. How lame do you think we are?! I won't feed the trolls... I won't feed the trolls... I won't feed the trolls... I won't feed the trolls... --- Heiko. -- http://mail.python.org/mailman/listinfo/python-list

Re: IRC sockets and queries

2005-12-30 Thread Heiko Wundram
Jay wrote: > LMFAO! Yeah, me too. How lame do you think we are?! --- Heiko. -- http://mail.python.org/mailman/listinfo/python-list

Re: IRC sockets and queries

2005-12-30 Thread J4Y
http://h1.ripway.com/jay001/PyIRCnMo.txt -- http://mail.python.org/mailman/listinfo/python-list

Re: IRC sockets and queries

2005-12-30 Thread Jay
LMFAO! those were jokes for my friends. lol.and btw the dccpoper and bot and crap were jokes that i made up for my friends on the #python channel in freenode... It was a joke.Anyway.. My bad, its ok if u dont want to help... no one likes me on this group anyway... u guys just joined the crowd... bt

Re: IRC sockets and queries

2005-12-30 Thread Heiko Wundram
David Wahler wrote: > > Not only is this obnoxious, it doesn't even work. > > Not only is this _extremely_ obnoxious, but it doesn't even work. Don't > expect any help from me. > Thanks for pointing that out (I must've missed those two examples when I read the code). And I even pointed him in

Re: IRC sockets and queries

2005-12-30 Thread David Wahler
Jay wrote: > ok have this program and i set a socket 2 connect to the server...so i > can chat on the channels and stuff. my question is how would i go about > set a socket directly 2 an individual query? The last part of this paragraph is completely incomprehensible. > my program is right here.

Re: IRC sockets and queries

2005-12-30 Thread Heiko Wundram
Jay wrote: > ok have this program and i set a socket 2 connect to the server...so i > can chat on the channels and stuff. my question is how would i go about > set a socket directly 2 an individual query? Don't take this the hard way, but this question doesn't make sense, and your source code doe

IRC sockets and queries

2005-12-29 Thread Jay
ok have this program and i set a socket 2 connect to the server...so i can chat on the channels and stuff. my question is how would i go about set a socket directly 2 an individual query? my program is right here... http://h1.ripway.com/jay001/CopyofPyIRCnMo.txt BTW, im trying to set up a connec

Re: need help with recieving sockets

2005-12-18 Thread Peter Hansen
you. The "asyncore" package in the standard library or Twisted are two approaches, or you could learn about SocketServer and others also in the standard library and use them instead. http://www.amk.ca/python/howto/sockets/ -Peter -- http://mail.python.org/mailman/listinfo/python-list

need help with recieving sockets

2005-12-18 Thread Andrew
Hi I was wondering if any one could help me with a chat client I am writing my main issue is not in the sending of messages or in the connection setting. I am having issues receiving the messages. I am using Tkinter as the GUI and Python 2.3.5 my code has been edited so many times but no matte

Re: Embedded Python interpreter and sockets

2005-11-22 Thread wahn
Hi, actually that didn't solve the problem. As soon as you do something with the socket module it fails. Well, the solution I came up with is simply link the ../_socket.so into my Houdini plugin DSO which is ugly but solves the problem for the moment ... Happy hacking, Jan -- http://mail.pytho

Re: Embedded Python interpreter and sockets

2005-11-22 Thread wahn
Hey Chris, I fixed the problem in another way (don't ask me why that works). One detail I didn't talk about is that I use the Boost.Python library. So I just made sure that I load the socket module before I import my own Python script (using that socket module): ... object main_module((handle<>

Re: Embedded Python interpreter and sockets

2005-11-22 Thread wahn
Hi Chris, Thanks for your help. I'll try that ... Cheers, Jan -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedded Python interpreter and sockets

2005-11-18 Thread [EMAIL PROTECTED]
Hi Jan, I believe the problem lies with how Houdini uses dlopen() to open your plugin. It uses RTLD_LOCAL to load your plugin, which means that all your plugin's symbols (including the python symbols) are private to that library. Subsequent dlopen() calls, including those made by the python libr

Embedded Python interpreter and sockets

2005-11-18 Thread wahn
Hi, Here is a problem I came across and need some help with. I developed a little Python script with some classes which runs standalone and communicates with a database via sockets. So far everything works fine. I also successfully embedded the Python interpreter into a plugin for a commercial 3D

Re: strange sockets

2005-11-07 Thread Skink
Steve Holden wrote: > Skink wrote: > >> Sion Arrowsmith wrote: >> >>> conn.sendall(struct.pack("!i", len(data)) + data) >>> >>> or after creating conn >>> >>> conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) >>> >>> to disable Nagle. >>> >> >> >> Sion, >> >> thank you for your help, >> >> it

Re: strange sockets

2005-11-07 Thread Steve Holden
Skink wrote: > Sion Arrowsmith wrote: > >>conn.sendall(struct.pack("!i", len(data)) + data) >> >>or after creating conn >> >>conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) >> >>to disable Nagle. >> > > > Sion, > > thank you for your help, > > it works but... > it works when client & se

Re: strange sockets

2005-11-07 Thread Skink
Sion Arrowsmith wrote: > > conn.sendall(struct.pack("!i", len(data)) + data) > > or after creating conn > > conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) > > to disable Nagle. > Sion, thank you for your help, it works but... it works when client & server is in python i tried both s

Re: strange sockets

2005-11-06 Thread Skink
Bryan, > > Sion Arrowsmith is right about what causes the delay. > Just in case your real code looks like this, I'll note: > >> len, = struct.unpack("!i", s.recv(4)) >> data = s.recv(len) yes, my mistake ;) > > > First, you almost certainly don't want to use the name 'len'. > Ought not

Re: strange sockets

2005-11-06 Thread Skink
Sion, > Solutions: either change > > >> conn.sendall(struct.pack("!i", len(data))) >> conn.sendall(data) > > > to > > conn.sendall(struct.pack("!i", len(data)) + data) > > or after creating conn > > conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) > > to disable Nagle. t

Re: strange sockets

2005-11-04 Thread Bryan Olson
Skink wrote: [...] > what's wrong here? Sion Arrowsmith is right about what causes the delay. Just in case your real code looks like this, I'll note: > len, = struct.unpack("!i", s.recv(4)) > data = s.recv(len) First, you almost certainly don't want to use the name 'len'. Ought not to b

Re: strange sockets

2005-11-04 Thread Jim Segrave
tocol 1.0 and for each class/resource >creates own connection. >Instead I'd like to use raw sockets with simple protocol: > > - class loader sends a line terminated with \n with resource to get > - python server reads that line, gets the file and sends back an >integer with file len

Re: strange sockets

2005-11-04 Thread Sion Arrowsmith
In article <[EMAIL PROTECTED]>, Skink <[EMAIL PROTECTED]> wrote: >% python client.py client.py client.py client.py server.py server.py >init 0.00066089630127 >client.py 0.000954866409302 >client.py 0.0408389568329 >client.py 0.0409188270569 >server.py 0.0409059524536 >server.py 0.0409259796143 > >

strange sockets

2005-11-04 Thread Skink
Hi, I'm preparing a python server that sends java classes and resources to custom java class loader. In order to make it faster I don't want to use URLClassLoader that uses HTTP protocol 1.0 and for each class/resource creates own connection. Instead I'd like to use raw sock

Re: closing sockets

2005-10-04 Thread Grant Edwards
On 2005-10-04, Grant Edwards <[EMAIL PROTECTED]> wrote: >> socket.error: (98, 'Address already in use') >> >> how can i get around that > > http://www.google.com/search?hl=en&q=socket.error%3A+%2898%2C+%27Address+already+in+use%27%29&btnG=Google+Search > > The first hit has this link which explain

Re: closing sockets

2005-10-04 Thread Grant Edwards
On 2005-10-04, Mohammed Smadi <[EMAIL PROTECTED]> wrote: > hi; > > i am executing program whcih uses a tcp socket. At the end of the program > i do s.close() where s is my socket. > > when i try to run the program again right away i get the following error > Traceback (most recent call last): >

closing sockets

2005-10-04 Thread Mohammed Smadi
hi; i am executing program whcih uses a tcp socket. At the end of the program i do s.close() where s is my socket. when i try to run the program again right away i get the following error Traceback (most recent call last): File "asterisk_login.py", line 14, in ? s.bind(("", hp_port)) # do

Re: threads/sockets quick question.

2005-09-19 Thread [EMAIL PROTECTED]
The problem may be something to do with using "threading" as identifier name. It is name of a module and definitely what you want it done anyway. You are better off having another variable as counter (with a different name). Raghu. -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread Ed Hotchkiss
Let's say that I avoid the complexities of using classes, and that I avoid using anything to count the threads...   import socketimport threading def scan(ip, port):    try:    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)    s.connect((ip, port))    s.close()    print '%s |

Re: threads/sockets quick question.

2005-09-19 Thread dowskimania
ed wrote: > this script should create individual threads to scan a range of IP > addresses, but it doesnt, it simple ... does nothing. it doesnt hang > over anything, the thread is not being executed, any ideas anyone? [SNIP] > while threading < MAX_THREADS: > scanThre

Re: threads/sockets quick question.

2005-09-19 Thread Simon Percivall
Why do you check if the module threading is less than 50? (this is why nothing happens, it's always false). >From where do you get port_counter in method run() of scanThread? (this would make every call to run() raise an exception. -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread n00m
import socket import thread def scan(ip, port): try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((ip, port)) s.close() print '%s | %d OPEN \nscanned: %d' % (ip, port, port) except: pass ip = 'localhost' for port in range(50, 5000

Re: threads/sockets quick question.

2005-09-19 Thread Bryan Olson
Fredrik Lundh wrote: > Bryan Olson wrote: > >>Next, you never create any instances of scanThread. > > > one would think that the "scanThread()" part of > > scanThread().start() > > would do exactly that. And one would be correct. I hereby retract that assertion of my post. -- --B

Re: threads/sockets quick question.

2005-09-19 Thread antred
maybe try this while threading.activeCount() < MAX_THREADS: # instead of while threading < MAX_THREADS: -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread antred
Ah shoot, never mind, I'm an idiot. =0 -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread antred
This may be a really stupid question, but are you actually CALLING your scan() function anywhere? -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread Piet van Oostrum
bers. The latter approach would be simpler IMO. You may also have to take into account if your OS allows a maximum number of open sockets for a process. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread Piet van Oostrum
> Bryan Olson <[EMAIL PROTECTED]> (BO) wrote: >BO> ed wrote: >>> this script should create individual threads to scan a range of IP >>> addresses, but it doesnt, it simple ... does nothing. it doesnt hang >>> over anything, the thread is not being executed, any ideas anyone? >BO> It's because

Re: threads/sockets quick question.

2005-09-19 Thread Fredrik Lundh
Bryan Olson wrote: > Next, you never create any instances of scanThread. one would think that the "scanThread()" part of scanThread().start() would do exactly that. -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread ed
import socket import threading import traceback class scanThread(threading.Thread): def run(self): try: ss = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ss.connect((ip, port_counter)) print "%s | %d OPEN" % (ip, port_counter) ss.cl

Re: threads/sockets quick question.

2005-09-19 Thread Ed Hotchkiss
  Well, I fixed those problems, now what I have is this: but i am getting errors with the global variables or something ... am i supposed to use this class and def together differently? I just don't seem to understand ... -edward import socketimport threadingimport traceback class scanThread(thr

Re: threads/sockets quick question.

2005-09-19 Thread Bryan Olson
ed wrote: > this script should create individual threads to scan a range of IP > addresses, but it doesnt, it simple ... does nothing. it doesnt hang > over anything, the thread is not being executed, any ideas anyone? It's because of the bugs. Nothing happens because threading < MAX_THREADS

threads/sockets quick question.

2005-09-18 Thread ed
this script should create individual threads to scan a range of IP addresses, but it doesnt, it simple ... does nothing. it doesnt hang over anything, the thread is not being executed, any ideas anyone? -- import socket import threading import traceback MAX_THREADS = 50 class scanThrea

Re: Sockets: code works locally but fails over LAN

2005-09-09 Thread Bryan Olson
n00m wrote: [...] > Btw, the newest oops in the topic's subject is: > the code does not work in the case of: > > sqls_host, sqls_port = '192.168.0.8', 1433 > proxy_host, proxy_port = '192.168.0.3', 1434 > ## proxy_host, proxy_port = '127.0.0.1', 1434 > ## proxy_host, proxy_port = '', 1434 >

Re: Sockets: code works locally but fails over LAN

2005-09-08 Thread n00m
Thanks, Bryan, for the details! Btw, the newest oops in the topic's subject is: the code does not work in the case of: sqls_host, sqls_port = '192.168.0.8', 1433 proxy_host, proxy_port = '192.168.0.3', 1434 ## proxy_host, proxy_port = '127.0.0.1', 1434 ## proxy_host, proxy_port = '', 1434 I.e. w

Re: Sockets: code works locally but fails over LAN

2005-09-07 Thread Bryan Olson
n00m wrote: > Btw, why we need send() if there is sendall()? Mostly because sendall() can block, even if you do all the select() and setblocking() magic. That's no problem in the threaded architecture we're using, but a deal-breaker for a single-threaded server. -- --Bryan -- http://mail.pytho

Re: Sniffer with RAW SOCKETS

2005-09-07 Thread Grant Edwards
On 2005-09-07, billiejoex <[EMAIL PROTECTED]> wrote: > Hi all. I'm trying to make a simple icmp sniffer by using > SOCK_RAW. Just a suggestion: you'd probably be better off using the PCAP library. > The code below works but ONLY if I first use the sendto() > function. Does anybody knows why? 'F

Sniffer with RAW SOCKETS

2005-09-07 Thread billiejoex
Hi all. I'm trying to make a simple icmp sniffer by using SOCK_RAW. The code below works but ONLY if I first use the sendto() function. Does anybody knows why? Regards from socket import * import select def recv(): while 1: if s in select.select([s],[],[],99)[0]: reply = s.

Re: Sockets: code works locally but fails over LAN

2005-09-07 Thread n00m
I was trying to test the send() vs sendall() like this: x=send(data) print len(data)-x > 0 ? (when the code fails) but I could not reproduce the failures anymore. As if the lan got "refreshed" after the first using of sendall() instead of send(). Btw, why we need send() if there is sendall()? -

Re: Sockets: code works locally but fails over LAN

2005-09-04 Thread n00m
Bryan Olson wrote: > Ah, yes, I see. (In my defense, I had already fixed that bug in > my second version.) 1. Yes! I myself noticed that, but your 2nd version looks a bit more verbose. 2. This all means... what? ONLY send() vs sendall() matters? Sometimes send() really sends ALL and my version work

Re: Sockets: code works locally but fails over LAN

2005-09-04 Thread Bryan Olson
n00m wrote: > Bryan; > Look at how I corrected your the very first version > (see added arguments in both functions). And now it > really can handle multiple connections! Ah, yes, I see. (In my defense, I had already fixed that bug in my second version.) -- --Bryan -- http://mail.python.or

Re: Sockets: code works locally but fails over LAN

2005-09-03 Thread n00m
Bryan; Look at how I corrected your the very first version (see added arguments in both functions). And now it really can handle multiple connections! import socket, thread sqls_host, sqls_port = '127.0.0.1', 1433 proxy_host, proxy_port = '127.0.0.1', 1434 # How I tested it: # sqls_host, sqls_p

Re: Sockets: code works locally but fails over LAN

2005-09-03 Thread Bryan Olson
Dennis Lee Bieber wrote: > Bryan Olson declaimed the following in comp.lang.python: > >>No, my guess is that you're running an old version of Python. >>The constant was added in the source on 27 Nov 2003; I'm not > > > Are you sure of that 2003? Yes, but that's when it went into the sourc

Re: Sockets: code works locally but fails over LAN

2005-09-03 Thread n00m
1. Python 2.3.4 2. Win98 and Win2k Professional -- http://mail.python.org/mailman/listinfo/python-list

Re: Sockets: code works locally but fails over LAN

2005-09-03 Thread Peter Hansen
n00m wrote: > Bryan wrote: > PS Yes! Your last version works like a champ. It easily handles up > to 5 instances of my.vbs! Except of this thing: > >>AttributeError: 'module' object has no attribute 'SHUT_WR' > > Seems it's a pure Unix constant. Definitely not. Are you sure you've got a proper

Re: Sockets: code works locally but fails over LAN

2005-09-03 Thread Bryan Olson
n00m wrote: > Your last version works like a champ. It easily handles up > to 5 instances of my.vbs! Except of this thing: > >>AttributeError: 'module' object has no attribute 'SHUT_WR' > > Seems it's a pure Unix constant. No, my guess is that you're running an old version of Python. The con

Re: Sockets: code works locally but fails over LAN

2005-09-03 Thread n00m
Bryan wrote: > Do you want to be a network engineer? lol... definetely not! It's just my curiosity. At my work my tools are: vba, vbs, jet-sql (ms access), t-sql (ms sql server). The pretty humble set. > My first two guess are: > The client is trying to make more than one connection. > Put

Re: Sockets: code works locally but fails over LAN

2005-09-02 Thread Bryan Olson
n00m wrote: > My today's tests (over LAN). > I think *it* will drive me mad very soon. Network programming is like that. Just because something worked once doesn't mean it really works. I had guessed two causes for the behavior you were seeing, and either could result in sporadic failures. >

Re: Sockets: code works locally but fails over LAN

2005-09-02 Thread n00m
My today's tests (over LAN). I think *it* will drive me mad very soon. Firstly I tested both Bryan's codes. And they worked fine! Just as if they were tested locally! Then I tested Fredrik suggestion. And it worked out too. Expect unexpected, - as they say. At last I decided to test my own versi

Re: Sockets: code works locally but fails over LAN

2005-09-02 Thread Bryan Olson
I wrote: > Below is a version that respects ^C to terminate > more-or-less cleanly. Oops, one more bug^H^H^H improvement. I forgot to shutdown writing. > import socket, threading, select > > sqls_host, sqls_port = '192.168.0.3', 1443 > proxy_host, proxy_port = '', 1434 > > > def start_d

Re: Sockets: code works locally but fails over LAN

2005-09-01 Thread Bryan Olson
n00m wrote: >>Bryan; > > I tested your code locally (in I*D*L*E) - it works fine! Glad it worked, but I'd still disrecommend IDLE for that version. Threads may live after the program seems to be done (and may still own the port you need). Below is a version that respects ^C to terminate more-or

Re: Sockets: code works locally but fails over LAN

2005-09-01 Thread n00m
>Bryan; I tested your code locally (in I*D*L*E) - it works fine! And of course I'll test it over LAN but only tomorrow - at work. See the picture of my IDLE window with output of your code: http://free.7host02.com/n00b/socket_Br.gif Note the 4th line in Blue: there Z is the name of my home machine,

Re: Sockets: code works locally but fails over LAN

2005-09-01 Thread John Hazen
st, port)) I think the problem is that you're using the same host for both the send and recieve sockets. Wouldn't you want one host to be the localhost, and one to be sql server? If it doesn't work even when only the VBscript is on a different box, are you running an OS with a f

Re: Sockets: code works locally but fails over LAN

2005-09-01 Thread Fredrik Lundh
"n00m" <[EMAIL PROTECTED]> wrote: > PEOPLE, WHY ON THE EARTH IT DOES NOT WORK OVER LAN ??? what happens if you change s1.bind((host, port)) to s1.bind(("", port)) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Sockets: code works locally but fails over LAN

2005-08-31 Thread Bryan Olson
n00m wrote: > import socket, thread > host, port = '192.168.0.3', 1434 Consider using INADDR_ANY instead of the specific host IP address. The empty string will resolve to INADDR_ANY if passed as the host to bind(). (Though that's not the problem.) > s1 = socket.socket(socket.AF_INET, socket.S

Re: Sockets: code works locally but fails over LAN

2005-08-31 Thread Grant Edwards
On 2005-08-31, Bryan Olson <[EMAIL PROTECTED]> wrote: >>>2. I'm not at all sure that accessing the same socket object >>>simultaneously from two threads is safe. >> >> It's OK under Unix. Having one thread handle rx and a >> different one handle tx is a pretty widely used method. >> >> Don't know

Re: Sockets: code works locally but fails over LAN

2005-08-31 Thread Bryan Olson
Grant Edwards wrote: > Peter Hansen wrote: > > >>2. I'm not at all sure that accessing the same socket object >>simultaneously from two threads is safe. > > It's OK under Unix. Having one thread handle rx and a > different one handle tx is a pretty widely used method. > > Don't know abou

Re: Sockets: code works locally but fails over LAN

2005-08-31 Thread n00m
Thank you all for your replies! 1. repr() is not what I need (currently). I'd better like to see the pure text of "talkings" between VBS and SQL Server. 2. Jp, thank you very much for the links! I just oblige to test this Twisted stuff, but I'm afraid it's a bit above my head so far. And, frankly s

Re: Sockets: code works locally but fails over LAN

2005-08-31 Thread Jp Calderone
On 31 Aug 2005 06:03:00 -0700, n00m <[EMAIL PROTECTED]> wrote: >import socket, thread >host, port = '192.168.0.3', 1434 >s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >s2.connect((host, 1433)) >s1.bind((host, port)) >s1.listen(1) >cn,

Re: Sockets: code works locally but fails over LAN

2005-08-31 Thread Grant Edwards
On 2005-08-31, Peter Hansen <[EMAIL PROTECTED]> wrote: > 2. I'm not at all sure that accessing the same socket object > simultaneously from two threads is safe. It's OK under Unix. Having one thread handle rx and a different one handle tx is a pretty widely used method. Don't know about Win32.

Re: Sockets: code works locally but fails over LAN

2005-08-31 Thread Peter Hansen
and \b screwing things up. 2. I'm not at all sure that accessing the same socket object simultaneously from two threads is safe. You might consider creating a pair of Queue objects to safely communicate the information between the two threads. That, of course, poses the problem of how d

Sockets: code works locally but fails over LAN

2005-08-31 Thread n00m
import socket, thread host, port = '192.168.0.3', 1434 s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2.connect((host, 1433)) s1.bind((host, port)) s1.listen(1) cn, addr = s1.accept() def VB_SCRIPT(): while 1: data = cn.re

Re: Closing programs that use sockets

2005-08-27 Thread billiejoex
Awesome. :-) Thank you. > You may find that CTRL/Break works even when CTRL/C doesn't. > > regards > Steve > -- > Steve Holden +44 150 684 7255 +1 800 494 3119 > Holden Web LLC http://www.holdenweb.com/ > -- http://mail.python.org/mailman/listinfo/python-list

Re: Closing programs that use sockets

2005-08-26 Thread Steve Holden
billiejoex wrote: > Hi all. I got a problem when using socket modules. > By using them I can't stop my program by pressing ctrl+c. > The only way to doit is by killing the python.exe process manually. > Is there a solution to avoid this? > > Regards > > You may find that CTRL/Break works even w

Closing programs that use sockets

2005-08-26 Thread billiejoex
Hi all. I got a problem when using socket modules. By using them I can't stop my program by pressing ctrl+c. The only way to doit is by killing the python.exe process manually. Is there a solution to avoid this? Regards -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib leaves sockets open?

2005-08-21 Thread Paul Rubin
"Chris Tavares" <[EMAIL PROTECTED]> writes: > Is there a way to do HTTP 1.1 with urllib? The docs say 0.9 and 1.0 only. I'm not sure. Try urllib2, but I'm still not sure. -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib leaves sockets open?

2005-08-21 Thread Chris Tavares
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > "Chris Tavares" <[EMAIL PROTECTED]> writes: > > Is this normal behavior for urllib? Is there a way to force that initial > > socket closed earlier? Is there something else I need to do? > > I'd say open a sourceforge

Re: urllib leaves sockets open?

2005-08-20 Thread Paul Rubin
"Chris Tavares" <[EMAIL PROTECTED]> writes: > Is this normal behavior for urllib? Is there a way to force that initial > socket closed earlier? Is there something else I need to do? I'd say open a sourceforge bug. There may be a way around it with the fancy opener methods of urllib2, but it's a b

urllib leaves sockets open?

2005-08-20 Thread Chris Tavares
Hi all. I'm currently tracking down a problem in a little script[1] I have, and I was hoping that those more experienced than myself could weigh in. The script's job is to grab the status page off a DLink home router. This is a really simple job: I just use urllib.urlopen() to grab the status page

Re: sockets don't play nice with new style classes :(

2005-05-14 Thread Skip Montanaro
Paul> It seems to me that the socket module itself should be rewritten Paul> to use new style classes, so that socket.socket objects can extend Paul> _socket.socket instead of wrapping them. Paul> Am I missing something? Probably not. The socket module could use some attention.

sockets don't play nice with new style classes :(

2005-05-14 Thread Paul Rubin
Just a slight rant, I think I can find a workaround. I wanted to trace all the output being sent through a socket: from socket import * sock = socket() socket.connect((host, post)) socket.send('hello over there\n') # I want to log the string Sounds like a job for new style classes:

Re: Sockets

2005-05-05 Thread Jp Calderone
ts. From time to time, >I'll need to write a small amount of data on one of those sockets. A >notification to write to one of the sockets will come from another >program/process. > >I think that the best way to send the notification to this server >application is via a u

Re: Sockets

2005-05-05 Thread Mike Meyer
I > share the socket connection across the two threads? (Thread 1 will be > accepting client connections, thread 2 will we writing data to it.) > Or should I simply let 'select' time out after some period? A udp port is just another socket - meaning another file descriptor. Unix

Sockets

2005-05-05 Thread Dan
I have a problem and I don't quite know how to implement the solution. I'll have a server application that will listen on a tcp port and make many similtaneous connections to remote clients. From time to time, I'll need to write a small amount of data on one of those sockets.

Re: Python sockets and recvmsg

2005-05-02 Thread Heiko Wundram
On Monday 02 May 2005 14:50, Heiko Wundram wrote: > How would you go about implementing this functionality? I don't think that > a standard recv() does what I want... Okay, looking at google would've been appropriate... There's Python Eunuchs... I wonder why this hasn't made it into the standard

Python sockets and recvmsg

2005-05-02 Thread Heiko Wundram
Hi all! I've read up on unix domain sockets, and I've seen that you can send out of bound messages such as sending the processes credentials over the socket. Receiving this requires to call recvmsg, which seems to be unavailable on the standard Python socket type. How would yo

Sockets SO_RCVBUF

2005-04-29 Thread Josh
I have written a simple TCP client/server. I would like to change the TCP receive buffer on the server side, to see performance differences. I am trying err = sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 4096) but that doesn't seem to actual change the buffer size. The code is:

Sniffing at two sockets

2005-04-26 Thread n00m
_ "waitfor delay '00:00:03'; raiserror ('BBB',10,1) with nowait;" & _ "waitfor delay '00:00:03'; raiserror ('CCC',10,1) with nowait;" & _ "waitfor delay '00:00:03'; select '';"

Sockets (jepler@unpythonic.net)

2005-04-11 Thread Mccormick . Johnw
Hello, ... I am John McCormick (Systems Programmer ) and I am currently working on a python program which will connect (user) specified inputs and connect them to (user) selected outputs (like screen or video/audio-recording devices) and would like to know if there's a technique to "test" or "se

Sockets (Dan)

2005-04-11 Thread Mccormick . Johnw
2:03cc PM Subject Sockets (Dave Br

Sockets (Dave Brueck)

2005-04-11 Thread Mccormick . Johnw
Hello, ... I am John McCormick (Systems Programmer ) and I am currently working on a python program which will connect (user) specified inputs and connect them to (user) selected outputs (like screen or video/audio-recording devices) and would like to know if there's a technique to "test" or "sens

<    1   2   3   4   5   6   >