sockets question

2005-02-25 Thread Mohammed Smadi
hi; i have the following piece of code: = s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.bind(("",port)) s.sendto(data,(MY_GW,port)) data = s.recvfrom(1024) data contains some instructions which i am sending to MY_GW. If the reply arrives from the MY_GW quickl

tcp socket programming

2005-10-04 Thread Mohammed Smadi
hi; If i have a tcp connection with a remote server, what is a good way to read all the data into a buffer before starting to process the data? I know that the data recieved will be 3 lines with CRLF between them. However if I can sock.recv(1024) the output is not consistent all the time, somet

Re: tcp socket programming

2005-10-04 Thread Mohammed Smadi
On Tue, 4 Oct 2005, Irmen de Jong wrote: > Mohammed Smadi wrote: > > hi; > > If i have a tcp connection with a remote server, what is a good way to > > read all the data into a buffer before starting to process the data? > > I know that the data recieved will be 3 l

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

how to get any available port

2005-10-04 Thread Mohammed Smadi
hi; if am using s.bind for a tcp socket. On the client side i dont really care which socket i use as long as i get an available socket. Is there a funciton or a way to get an available socket? thanks smadi -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get any available port

2005-10-04 Thread Mohammed Smadi
On Tue, 4 Oct 2005, Grant Edwards wrote: > On 2005-10-04, ncf <[EMAIL PROTECTED]> wrote: > > > Hmm...perhaps he is trying to do a transfer thing like many chat > > programs do. Instead of sending large files across a server, you > > "Direct Connect" and send the file directly. :shrugs: > > So ho

calling matlab

2005-10-12 Thread Mohammed Smadi
Hi; Does anyone know if we can call matlab for a python or bash script while feeding the matlab script some command line arguments? I have an interactive matlab script which i want to automate by feeding the args from a script. I know this is probably more suitable to a matlab group but any i

pyNMS

2005-09-14 Thread Mohammed Smadi
hi anybody used pyNMS b4? I compiled it and seem to be able to import modules but cannot use em, or more like cannot call them since if i do something like: import ping ping.ttl(..) i get an error like Traceback (most recent call last): File "", line 1, in ? AttributeError: 'module' object ha

socket.gethostbyaddr problem

2005-09-17 Thread Mohammed Smadi
hi; I am trying to do some very basic socket programming and i get the following error. Any help will be appreciated: Code: import socket x = socket.gethostbyaddr("www.google.ca") return an error: socket.herror: (1, 'Unknown host') I tried replacing the web URL with an IP address on the net, o