Re: [Tutor] Socket error in class, part the second

2017-03-10 Thread Alan Gauld via Tutor
On 10/03/17 12:38, leam hall wrote: > As noted, the fix was to put the "import socket" above the class > declaration. What confuses me is that in the calling program I'm importing > the class: > > from mysocket import mysocket > > In mysocket.py the "import socket" is above the class declarati

[Tutor] Socket error in class, part the second

2017-03-10 Thread leam hall
y'all, Thanks for the explanations! Sorry for the delay in responding, it's been a rough year these past couple weeks. As noted, the fix was to put the "import socket" above the class declaration. What confuses me is that in the calling program I'm importing the class: from mysocket import mys

Re: [Tutor] Socket error in class

2017-03-06 Thread Steven D'Aprano
On Mon, Mar 06, 2017 at 12:35:27PM -0500, leam hall wrote: > What am I missing? Let us start by reading the exception that you get, below the class. That tells us *what* error occurred, but not how or why: > class mysocket(): > import socket > def __init__(self, sock=None); > if sock is

Re: [Tutor] Socket error in class

2017-03-06 Thread Mats Wichmann
On 03/06/2017 10:35 AM, leam hall wrote: > What am I missing? > > > class mysocket(): > import socket > def __init__(self, sock=None); > if sock is None: > self.sock = socket.socket(socket.socket.AF_NET, > socket.socket.SOCK_STREAM) > else: > self.sock = sock > > > #

Re: [Tutor] Socket error in class

2017-03-06 Thread Alan Gauld via Tutor
On 06/03/17 17:35, leam hall wrote: > What am I missing? I'd start by moving the import out of the class to its more normal position at the top of the file. > > class mysocket(): > import socket > def __init__(self, sock=None); > if sock is None: > self.sock = socket.socket(sock

[Tutor] Socket error in class

2017-03-06 Thread leam hall
What am I missing? class mysocket(): import socket def __init__(self, sock=None); if sock is None: self.sock = socket.socket(socket.socket.AF_NET, socket.socket.SOCK_STREAM) else: self.sock = sock Error: NameError: global name "socket" is not defined. __

Re: [Tutor] socket communications and threading

2015-10-27 Thread Alan Gauld
On 27/10/15 23:58, Alan Gauld wrote: that enable multiple tasks to run in parallel on a single computer. Each thread is a sub-process of the parent process. I should add that this is a bit of a simplification because threading varies in implementation depending on OS and language. Threads are

Re: [Tutor] socket communications and threading

2015-10-27 Thread Alan Gauld
On 27/10/15 17:51, richard kappler wrote: Sorry, thought it was clear. Each of the three different data generating machines (in the test env, the python script that sends the data with 3 different device names) goes over a different thread so the developers tell me. OK, You need to get the co

Re: [Tutor] socket communications and threading

2015-10-27 Thread richard kappler
Sorry, thought it was clear. Each of the three different data generating machines (in the test env, the python script that sends the data with 3 different device names) goes over a different thread so the developers tell me. In production, those three machines are microcontrollers, not full blown c

Re: [Tutor] socket communications and threading

2015-10-27 Thread Alan Gauld
On 27/10/15 14:52, richard kappler wrote: In our test environment we have simulated this by building three vm's. VM1 has a python script that sends raw data over tcp to VM2 which parses the data and sends it over tcp to VM3 upon which we are developing our analytics apps. ... 1. The data from

[Tutor] socket communications and threading

2015-10-27 Thread richard kappler
I'm having difficulty wrapping my arms around sockets and threading, not so much from a 10,000 foot/ network perspective, but from a low level perspective. In our production environment we have three machines that generate data and forward it over tcp to a computer that stores the data, parses it

Re: [Tutor] Socket Module

2015-07-30 Thread Nym City via Tutor
Writing to share an update on my previous request. So, after reviewing my code over, it seems like my last print statement "print(ResolvedAddresses)" was not properly indented inside the for loop - and for that reason the output was coming our as empty. After I aligned that with the rest of the l

Re: [Tutor] Socket Module

2015-07-28 Thread Nym City via Tutor
Hi Martin, Thank you for taking the time to write such a detailed response. Very much appreciate it. I tried the code again with modifications that you suggested and even though none of the public addresses resolved; I did get little more details. I am still working on finding a solution for th

Re: [Tutor] Socket Module

2015-07-26 Thread Martin A. Brown
Hello Nym, Here is the updated code: https://bpaste.net/show/358583e1a0bd It's short. I have included inline here: import socket ListOfIPAddresses = [] with open('top500ips.csv', 'r') as f: for line in f: line = line.strip() ListOfIPAddresses.append(line)

Re: [Tutor] Socket Module

2015-07-25 Thread Nym City via Tutor
Thank you all for your responses. I have taken your feedback and made changes to my code. -Danny, per your suggestion, I have renamed some of my variables to make their purpose little more clearer. - Alan,  I have created a new host list (ResolvedAddresses) which is storing the output from socke

Re: [Tutor] Socket Module

2015-07-20 Thread Alan Gauld
On 20/07/15 00:55, Nym City via Tutor wrote: Thank you for your response. I gave it another try: As suggested, first I ran the concept just in the terminal, and it worked fine: names =['173.252.120.6', '98.139.183.24'] import socket for name in names: socket.gethostbyaddr(name) print(

Re: [Tutor] Socket Module

2015-07-19 Thread Danny Yoo
> for name in domains: > socket.gethostbyaddr(name) > print(name) > > output: > 173.252.120.6 > 98.139.183.24 > > What am I missing? Thank in advance. > You have confused yourself a little because the variable names you've chosen are slightly misleading. Specifically, "name" is really an

Re: [Tutor] Socket Module

2015-07-19 Thread Nym City via Tutor
Thank you for your response. I gave it another try: As suggested, first I ran the concept just in the terminal, and it worked fine: >>> names =['173.252.120.6', '98.139.183.24'] >>> import socket >>> for name in names:     socket.gethostbyaddr(name)     print(name)   output:  ('edge-star-shv-12-f

Re: [Tutor] Socket Module

2015-07-18 Thread Danny Yoo
On Jul 18, 2015 3:50 PM, "Nym City via Tutor" wrote: > > Thank you all for your responses. I have a follow up question: > > So if gethostbyname_ex() takes only a single hostname string, how can I use it to go through a list of hostnames and get their IP resolution as an output? > Look into loops.

Re: [Tutor] Socket Module

2015-07-18 Thread Nym City via Tutor
Thank you all for your responses. I have a follow up question: So if gethostbyname_ex() takes only a single hostname string, how can I use it to go through a list of hostnames and get their IP resolution as an output? This would mean,socket.gethostbyaddr() would also not work for my second pro

Re: [Tutor] Socket Module

2015-07-13 Thread Alan Gauld
On 12/07/15 23:36, Nym City via Tutor wrote: import csv import socket domains = open('top500domains.csv', 'r') for domain in domains: domain = socket.gethostbyname(str(domains)) You are passing your file object to gethostbyname() print(domains + "\n") For the code above, I receive

Re: [Tutor] Socket Module

2015-07-12 Thread Danny Yoo
One other thing to note: if you're working with a comma-separated value file (CSV), then you may want to use the 'csv' module to parse it. https://docs.python.org/3.5/library/csv.html This should allow you to walk through the file as if it were a sequence of records. In contrast, if you're d

Re: [Tutor] Socket Module

2015-07-12 Thread Cameron Simpson
On 12Jul2015 22:36, Nym City wrote: Hello, I am working on a 2 individual programs. In the first program, I am taking in a list of domains in .csv format and want to get the associated IPs. In the second program, I want to import in a list of IP .csv and than get the associated domains out. Ev

[Tutor] Socket Module

2015-07-12 Thread Nym City via Tutor
Hello, I am working on a 2 individual programs. In the first program, I am taking in a list of domains in .csv format and want to get the associated IPs. In the second program, I want to import in a list of IP .csv and than get the associated domains out. Eventually I want to get both of the abo

Re: [Tutor] Socket programming

2015-01-03 Thread Alan Gauld
On 03/01/15 11:48, pramod gowda wrote: client code: import socket client_socket=socket.socket() server_address='192.168.2.2' server_port= 80 see below regarding port numbers print("hello") client_socket.connect((server_address,server_port)) print("hello") data=client_socket.recv(1024) prin

[Tutor] Socket programming

2015-01-03 Thread pramod gowda
Hi, i am learning socket programming, client code: import socket client_socket=socket.socket() server_address='192.168.2.2' server_port= 80 print("hello") client_socket.connect((server_address,server_port)) print("hello") data=client_socket.recv(1024) print(data) client_socket.close() server

Re: [Tutor] Socket Error Handling Syntax

2013-05-28 Thread eryksun
On Tue, May 28, 2013 at 3:49 PM, Dave Angel wrote: > I don't use Windows, but I doubt if there's a separate exception > type for 10057. Windows sockets error codes at or above 1 aren't mapped to POSIX error codes. Instead errno is set directly from winerror. So there's no reason to look at wi

Re: [Tutor] Socket Error Handling Syntax

2013-05-28 Thread Andreas Perstinger
On 28.05.2013 21:37, sparkle Plenty wrote: If I use an if statement, I cannot use continue after I do my error handling, so I am really trying to use the except errorname: instead of an if statement. I think you haven't understood the code snippet I've posted. The if-statement is inside the ex

Re: [Tutor] Socket Error Handling Syntax

2013-05-28 Thread Dave Angel
On 05/28/2013 03:37 PM, sparkle Plenty wrote: If I use an if statement, I cannot use continue after I do my error handling, The presence of an if statement cannot affect whether or not a continue can work. If you give a concrete code example, somebody will be able to identify the confusion.

Re: [Tutor] Socket Error Handling Syntax

2013-05-28 Thread sparkle Plenty
If I use an if statement, I cannot use continue after I do my error handling, so I am really trying to use the except errorname: instead of an if statement. Therefore, I have to find the correct error name to identify the 10057 condition to the interpreter, but thanks anyway, Andreas. On Tue, Ma

Re: [Tutor] Socket Error Handling Syntax

2013-05-28 Thread Andreas Perstinger
On 28.05.2013 19:25, sparkle Plenty wrote: I need to catch and handle 10057 exceptions when they occur and keep running. I know 10057 is a WinError, which is a subset of OSError, I just can't find the right syntax for it. I would appreciate some help on this one. I have neither Windows nor Py

[Tutor] Socket Error Handling Syntax

2013-05-28 Thread sparkle Plenty
Python 3.3, Windows operating system: I am communicating with a device using a Python script and I am coding except clauses in my send and receive functions to handle a particular error. I can't find a WinError example, and I can't get the syntax right. I have researched this and tried the follow

Re: [Tutor] Socket Programming

2013-04-08 Thread Lolo Lolo
on socket programming. if as a client or server, the information being sent has a buffer size on 2048, will this retrieve all data below 2KB? or can it be exceeded with say 2100? or does 2100 fall under 3KB?___ Tutor maillist - Tutor@python.org To uns

Re: [Tutor] Socket Programming

2013-04-08 Thread Alan Gauld
On 08/04/13 08:06, Mousumi Basu wrote: import socket import sys s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) try: s=s.bind(('172.18.2.11',2213)) print 'socket bind is complete' except socket.error,msg: print 'bind failed' sys.exit() Your first error is that when develo

Re: [Tutor] Socket Programming

2013-04-08 Thread Kushal Kumaran
Mousumi Basu writes: > I want to perform binding between two computers having ip addresses > 172.18.2.11 and 172.18.2.95.So i wrote the following code(on the computer > having IP address 172.18.2.95):- > > > import socket > import sys > s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) > try: >

Re: [Tutor] Socket Programming

2013-04-08 Thread Steven D'Aprano
On 08/04/13 17:06, Mousumi Basu wrote: I want to perform binding between two computers having ip addresses 172.18.2.11 and 172.18.2.95.So i wrote the following code(on the computer having IP address 172.18.2.95):- import socket import sys s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) try:

Re: [Tutor] Socket Programming

2013-04-08 Thread Timo
Op 08-04-13 09:06, Mousumi Basu schreef: I want to perform binding between two computers having ip addresses 172.18.2.11 and 172.18.2.95.So i wrote the following code(on the computer having IP address 172.18.2.95):- import socket import sys s=socket.socket(socket.AF_I

[Tutor] Socket Programming

2013-04-08 Thread Mousumi Basu
I want to perform binding between two computers having ip addresses 172.18.2.11 and 172.18.2.95.So i wrote the following code(on the computer having IP address 172.18.2.95):- import socket import sys s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) try: s=s.bind(('172.18.2.11',2213)) pr

Re: [Tutor] Socket Programming

2013-04-06 Thread Alan Gauld
On 05/04/13 11:47, Mousumi Basu wrote: s=socket.socket(socket.AF_INIT,socket.SCK_DGRM)) There is a double )) at the end of the line. That should give a different error so I assume this is not cut 'n paste code, but just in case I thought I'd point it out... s.bind(('172.18.2.11',8032)) Be

Re: [Tutor] Socket Programming

2013-04-05 Thread Chris Fuller
Have you checked out the socket HOWTO? http://docs.python.org/2/howto/sockets.html Cheers On Friday, April 05, 2013, Mousumi Basu wrote: > I want to perform bind function for socket programming between two > computers of ip addresses- 172.18.2.11 and 172.18.2.95 using the following > command(on

Re: [Tutor] Socket Programming

2013-04-05 Thread Steven D'Aprano
On 05/04/13 21:47, Mousumi Basu wrote: I want to perform bind function for socket programming between two computers of ip addresses- 172.18.2.11 and 172.18.2.95 using the following command(on the computer having IP address 172.18.2.95): s=socket.socket(socket.AF_INIT,socket.SCK_DGRM)) I get

[Tutor] Socket Programming

2013-04-05 Thread Mousumi Basu
I want to perform bind function for socket programming between two computers of ip addresses- 172.18.2.11 and 172.18.2.95 using the following command(on the computer having IP address 172.18.2.95): s=socket.socket(socket.AF_INIT,socket.SCK_DGRM)) s.bind(('172.18.2.11',8032)) But error is occurri

Re: [Tutor] Socket Programming

2012-01-29 Thread Navneet
On 1/27/2012 10:13 PM, Steven D'Aprano wrote: Navneet wrote: One more thing I want to add here is, I am trying to create the GUI based chat server.(Attached the programs.) Please do not send large chunks of code like this, unless asked. Instead, you should try to produce a minimal example t

Re: [Tutor] Socket Programming

2012-01-27 Thread Steven D'Aprano
Navneet wrote: One more thing I want to add here is, I am trying to create the GUI based chat server.(Attached the programs.) Please do not send large chunks of code like this, unless asked. Instead, you should try to produce a minimal example that demonstrates the problem. It should be:

Re: [Tutor] Socket Programming

2012-01-27 Thread Navneet
On 1/26/2012 4:22 PM, Navneet wrote: Hi, I am trying to create a chat program.(Programs are attached) Please find the code below, where I am having the problem. def run( self ): while 1: print "Hello There " print self.descriptors # Await an event on a readab

[Tutor] Socket Programming

2012-01-26 Thread Navneet
Hi, I am trying to create a chat program.(Programs are attached) Please find the code below, where I am having the problem. def run( self ): while 1: print "Hello There " print self.descriptors # Await an event on a readable socket descriptor (srea

Re: [Tutor] Socket not connecting

2011-10-19 Thread Alan Gauld
On 19/10/11 23:57, Christopher King wrote: (I might try increasing the listen value to say 3 or 5 but it shouldn't really be necessary) What exactly is the listen value (by the way, I'm jake's friend he was talking about.) It's essentially the number of messages in the queue. If you on

Re: [Tutor] Socket not connecting

2011-10-19 Thread Christopher King
> > (I might try increasing the listen value to say 3 or 5 but it shouldn't > really be necessary) What exactly is the listen value (by the way, I'm jake's friend he was talking about.) ___ Tutor maillist - Tutor@python.org To unsubscribe or change sub

Re: [Tutor] Socket not connecting

2011-10-19 Thread Alan Gauld
On 19/10/11 00:26, Jacob Bender wrote: worked on my computer, and executed perfectly. OK, So it probably a networking config issue. running the host program. The host program did absolutely nothing and my IP was programmed into the client as the "Host IP". Is it a DHCP generated IP address

Re: [Tutor] Socket not connecting

2011-10-18 Thread Walter Prins
Hi Jacob, On 19 October 2011 00:26, Jacob Bender wrote: > > I'm the same person who asked about intruders getting into my computer > via socket. I tried copying a socket program from online, that worked on my > computer, and executed perfectly. However, I did not open a port for python, > b

[Tutor] Socket not connecting

2011-10-18 Thread Jacob Bender
Dear Tutors, I'm the same person who asked about intruders getting into my computer via socket. I tried copying a socket program from online, that worked on my computer, and executed perfectly. However, I did not open a port for python, but I do have an exception in my firewall. Anyhow, I cal

Re: [Tutor] Socket and Ports

2011-10-16 Thread Jacob Bender
Thank you, and I'm not planning on executing any data I receive from anybody. So I should be pretty safe... On Sun, Oct 16, 2011 at 10:48 AM, Hugo Arts wrote: > On Sun, Oct 16, 2011 at 4:20 PM, bob gailer wrote: > > On 10/16/2011 8:28 AM, Jacob Bender wrote: > >> > >> Dear Tutors, > >> > >>

Re: [Tutor] Socket and Ports

2011-10-16 Thread Hugo Arts
On Sun, Oct 16, 2011 at 4:20 PM, bob gailer wrote: > On 10/16/2011 8:28 AM, Jacob Bender wrote: >> >> Dear Tutors, >> >>     I've been having an issue with socket. I wanted to use it for >> transmitting strings over the Internet. > > That's good, because strings is all you can transmit. > >> The p

Re: [Tutor] Socket and Ports

2011-10-16 Thread bob gailer
On 10/16/2011 8:28 AM, Jacob Bender wrote: Dear Tutors, I've been having an issue with socket. I wanted to use it for transmitting strings over the Internet. That's good, because strings is all you can transmit. The problem is that my friend insists that allowing python to transmit and

[Tutor] Socket and Ports

2011-10-16 Thread Jacob Bender
Dear Tutors, I've been having an issue with socket. I wanted to use it for transmitting strings over the Internet. The problem is that my friend insists that allowing python to transmit and receive information via an Internet port is a bad idea. He claimed that I could(and probably would) rec

Re: [Tutor] Socket Programming issue

2011-06-21 Thread Mark Tolonen
"aditya" wrote in message news:BANLkTikS+gzm=89thczpbwksd+wufec...@mail.gmail.com... This is a small client-server program in which i am using a Vbscript program to check for connectivity of 2 machines and write the output to a text file whether it connectes or not , for example the conten

Re: [Tutor] Socket Programming issue

2011-06-21 Thread aditya
On Tue, Jun 21, 2011 at 12:45 PM, Alan Gauld wrote: > > "aditya" wrote > > > is that although the Vbscript writes the output to the file correctly but >> when the client sends the contents of the file to the server via socket , >> it >> sometimes prints all the lines of the file on the server an

Re: [Tutor] Socket Programming issue

2011-06-21 Thread Alan Gauld
"aditya" wrote is that although the Vbscript writes the output to the file correctly but when the client sends the contents of the file to the server via socket , it sometimes prints all the lines of the file on the server and sometimes it doesnt , i dont know whether the issue is with the c

[Tutor] Socket Programming issue

2011-06-20 Thread aditya
This is a small client-server program in which i am using a Vbscript program to check for connectivity of 2 machines and write the output to a text file whether it connectes or not , for example the contents of the file *output.txt* are 192.168.1.2 is connected 192.168.1.10 is not connected No

Re: [Tutor] Socket and Changing IP's

2011-02-28 Thread Sander Sweers
On Tue,  1 Mar 2011, 01:02:23 CET, Jacob Bender wrote: >          I'm trying to be a host without having to keep the computer on ALL > of the time. Acting as a "Dropbox" would be an example. My IP doesn't > change very often. It's stayed the same for days. The best solution here is to get a

Re: [Tutor] Socket and Changing IP's

2011-02-28 Thread David Hutto
On Mon, Feb 28, 2011 at 7:02 PM, Jacob Bender wrote: > On 2/28/2011 6:57 PM, Wayne Werner wrote: > > On Mon, Feb 28, 2011 at 5:49 PM, Jacob Bender > wrote: >> >> Tutors, >> >>    I was looking into network programming, and I came across a problem. >> Socket programs need an IP address to function

Re: [Tutor] Socket and Changing IP's

2011-02-28 Thread Jacob Bender
On 2/28/2011 6:57 PM, Wayne Werner wrote: On Mon, Feb 28, 2011 at 5:49 PM, Jacob Bender > wrote: Tutors, I was looking into network programming, and I came across a problem. Socket programs need an IP address to function correctly, right? Well,

Re: [Tutor] Socket and Changing IP's

2011-02-28 Thread Wayne Werner
On Mon, Feb 28, 2011 at 5:49 PM, Jacob Bender wrote: > Tutors, > >I was looking into network programming, and I came across a problem. > Socket programs need an IP address to function correctly, right? Well, IP > addresses are always changing, so how should I go about making sockets that > wil

[Tutor] Socket and Changing IP's

2011-02-28 Thread Jacob Bender
Tutors, I was looking into network programming, and I came across a problem. Socket programs need an IP address to function correctly, right? Well, IP addresses are always changing, so how should I go about making sockets that will work for an extended period of time? Thanks in advance!

Re: [Tutor] socket

2010-06-27 Thread Alan Gauld
"Christopher King" wrote process. In other words, I want to connect two computers. I've looked up socket but the explanations are too complex. I think I need a 2-way conversation with a expert to understand it. Or even better, point me to a easier module. You can read the networking topic

[Tutor] socket

2010-06-26 Thread Christopher King
I'm wondering how to allow one process to communicate with another process. In other words, I want to connect two computers. I've looked up socket but the explanations are too complex. I think I need a 2-way conversation with a expert to understand it. Or even better, point me to a easier module

Re: [Tutor] socket timeout

2009-11-28 Thread Stefan Lesicnik
- "Sander Sweers" wrote: > 2009/11/27 Stefan Lesicnik : > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > > #s.setdefaulttimeout(1) > > s.connect((proxy,port)) > > I have never used socket but a quick look at the docs [1] my guess is > that you should use use s.settimeout() [2

Re: [Tutor] socket timeout

2009-11-27 Thread Sander Sweers
2009/11/27 Stefan Lesicnik : > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > #s.setdefaulttimeout(1) > s.connect((proxy,port)) I have never used socket but a quick look at the docs [1] my guess is that you should use use s.settimeout() [2]. The docs say that setdefaulttimeout [3] wi

[Tutor] socket timeout

2009-11-26 Thread Stefan Lesicnik
Hi guys, Maybe someone can point me in the right direction, since i'm not sure why i cant get the timeout to work. Admittedly i don't know much about socket programming. Im using the below code... s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #s.setdefaulttimeout(1) s.connect((pro

Re: [Tutor] socket / over network

2008-04-09 Thread linuxian iandsd
in case it helps here is a very basic example: import MySQLdb, glob, os, re, shutil from ftplib import FTP a=file_to_fetch ftp=FTP('ftp_server') ftp.login('user_name','password') try: aa=ftp.nlst(a) b='/home/a' bb=os.path.basename(aa[0]) e=os.path.basename(b) c=open(b, 'wb')

Re: [Tutor] socket / over network

2008-04-07 Thread Alan Gauld
"Nathan McBride" <[EMAIL PROTECTED]> wrote > Going off of wha tyou said, if I choose to use ftp, is there a way i > could do everything from within python including the server to get > the > files? Is there like a ftp module for python to help in the passing > of > the files between the comput

Re: [Tutor] socket / over network

2008-04-06 Thread Kim Hawtin
Hi Nathan, Nathan McBride wrote: > Alan Gauld wrote: >> "Nathan McBride" <[EMAIL PROTECTED]> wrote >>> I'm pretty tired of the lame backup solution we have at work. >>> Could anyone point me to a (more or less newbieish) example of how >>> to >>> have python open a socket on one box and get data f

Re: [Tutor] socket / over network

2008-04-06 Thread Nathan McBride
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Alan Gauld wrote: > "Nathan McBride" <[EMAIL PROTECTED]> wrote > > Hi Nathan, > > Please don't reply to an existing message to start a new discussion. > It messes up those of us using threaded mail/news readers and > increases the likelihood that your

Re: [Tutor] socket / over network

2008-04-03 Thread linuxian iandsd
re-inventing the wheel ? http://www.howtoforge.com/linux_backuppc > > > On Thu, Apr 3, 2008 at 3:44 PM, Alan Gauld <[EMAIL PROTECTED]> > wrote: > > > "Nathan McBride" <[EMAIL PROTECTED]> wrote > > > > Hi Nathan, > > > > Please don't reply to an existing message to start a new discussion. > > It m

Re: [Tutor] socket / over network

2008-04-03 Thread Alan Gauld
"Nathan McBride" <[EMAIL PROTECTED]> wrote Hi Nathan, Please don't reply to an existing message to start a new discussion. It messes up those of us using threaded mail/news readers and increases the likelihood that your message will be missed. > I'm pretty tired of the lame backup solution we ha

[Tutor] socket / over network

2008-04-03 Thread Nathan McBride
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey guys, I'm pretty tired of the lame backup solution we have at work. Could anyone point me to a (more or less newbieish) example of how to have python open a socket on one box and get data from it, then have another box write to it over the network

Re: [Tutor] Socket Timeout Handling

2007-09-11 Thread wormwood_3
Ok, just found your message in the archives. Thanks very much for that! By way of response-- >>That may be because your question ventures into fairly deep areas of >> networking >> that most folk who are just learning Python(ie readers of this list) >> have probably >> not encountered. True

Re: [Tutor] Socket Timeout Handling

2007-09-11 Thread wormwood_3
>I did send you a response and it is listed on the gmane archive >so if you didn't see it something has gone adrift somewhere. Just searched all my mail, for some reason I did not get this. I will check the archive. Thanks! >The solution you posted seems to bear no resemblence >to the problem yo

Re: [Tutor] Socket Timeout Handling

2007-09-11 Thread Alan Gauld
"wormwood_3" <[EMAIL PROTECTED]> wrote > Have not gotten any responses on this, I did send you a response and it is listed on the gmane archive so if you didn't see it something has gone adrift somewhere. > But, I did find a decent recipe on ASPN that serves the purpose, The solution you posted

Re: [Tutor] Socket Timeout Handling

2007-09-10 Thread wormwood_3
- Original Message From: wormwood_3 <[EMAIL PROTECTED]> To: Python Tutorlist Sent: Thursday, September 6, 2007 4:46:08 PM Subject: Re: [Tutor] Socket Timeout Handling Since no one bit on this yet, let me simplify to the core issue I am having: What is the best practice for checkin

Re: [Tutor] Socket Timeout Handling

2007-09-06 Thread Alan Gauld
"wormwood_3" <[EMAIL PROTECTED]> wrote > Since no one bit on this yet, let me simplify to the core issue I am > having: That may be because your question ventures into fairly deep areas of networking that most folk who are just learning Python(ie readers of this list) have probably not encount

Re: [Tutor] Socket Timeout Handling

2007-09-06 Thread wormwood_3
: wormwood_3 <[EMAIL PROTECTED]> To: Python Tutorlist Sent: Thursday, September 6, 2007 9:40:21 AM Subject: [Tutor] Socket Timeout Handling I am trying to figure out the optimal way to make socket connections (INET) and check for timeouts. The socket module has settimeout(timeou

[Tutor] Socket Timeout Handling

2007-09-06 Thread wormwood_3
I am trying to figure out the optimal way to make socket connections (INET) and check for timeouts. The socket module has settimeout(timeout) and setdefaulttimeout(timeout). However, so far as I can tell, these apply to socket objects. The type of socket connection I want to make is getfqdn(add

Re: [Tutor] Socket question.

2007-05-16 Thread Martin Walsh
Hey Dude :) Dude, WHOA! wrote: > kinda thing. The problem is that the client I wrote doesn't receive > data and display it, and it also only executes single word commands. > Server side: > #!/usr/bin/env python > try: > echo = Popen(command, stdout=PIPE).stdout.read() On a

Re: [Tutor] Socket question.

2007-05-16 Thread Alan Gauld
"Dude, WHOA!" <[EMAIL PROTECTED]> wrote > kinda thing. The problem is that the client I wrote doesn't receive > data and display it, and it also only executes single word commands. > Server side: > #!/usr/bin/env python > import socket > from subprocess import * > IP = 'localhost' > sock = socke

[Tutor] Socket question.

2007-05-16 Thread Dude, WHOA!
I thought I'd try my hand at sockets, and tried to make a telnet-ish, kinda thing. The problem is that the client I wrote doesn't receive data and display it, and it also only executes single word commands. Thanks in advance. Server side: #!/usr/bin/env python import socket from subprocess import

Re: [Tutor] socket and lost data

2006-01-27 Thread Alan Gauld
I'm a wee bit confused. > def envoyer(conn, mysize): > print mysize,' KB sent This doesn't seem to be true from the code. > data = '1'*1024 > data_end = data[:-5]+'#' > data = data*(mysize-1) So data is mysize-1 KB, but you printed mysize KB? > begining = time.time() >

Re: [Tutor] socket and lost data

2006-01-27 Thread Kent Johnson
le dahut wrote: > Hi, > I try to send some data across a network (between 400KB and 10MB) like > this : > def envoyer(conn, mysize): > print mysize,' KB sent' > data = '1'*1024 > data_end = data[:-5]+'#' > data = data*(mysize-1) > begining = time.time() > conn.sen

[Tutor] socket and lost data

2006-01-27 Thread le dahut
Hi, I try to send some data across a network (between 400KB and 10MB) like this : def envoyer(conn, mysize): print mysize,' KB sent' data = '1'*1024 data_end = data[:-5]+'#' data = data*(mysize-1) begining = time.time() conn.send(data) conn.send(data_end)

Re: [Tutor] Socket connection

2005-12-04 Thread Danny Yoo
> I need to get some whois-info from whois.ripe.net. I have been able to > connect and get the info that I need, but I would like to know what is > the most 'polite' way of doing so. I need to do quite a few whois > lookups (from my server logs) and don't want to risk creating more > hassle for t

[Tutor] Socket connection

2005-12-04 Thread Øyvind
Hello. I need to get some whois-info from whois.ripe.net. I have been able to connect and get the info that I need, but I would like to know what is the most 'polite' way of doing so. I need to do quite a few whois lookups (from my server logs) and don't want to risk creating more hassle for their

Re: [Tutor] socket question

2005-09-13 Thread Alan G
> When I receive a 4-bytes integer using socket.recv, it is stored in > a > string. How to convert this string to a integer? Look at the struct module. Its unpack method takes a format string which defines how the data should be interpreted. Have a look at the section at the end of my file han

Re: [Tutor] socket question

2005-09-13 Thread Kent Johnson
ray wrote: > When I receive a 4-bytes integer using socket.recv, it is stored in a > string. How to convert this string to a integer? Take a look at unpack() in module struct. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

[Tutor] socket question

2005-09-13 Thread ray
When I receive a 4-bytes integer using socket.recv, it is stored in a string. How to convert this string to a integer? Thanks in advance. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Socket Programming

2005-08-01 Thread Adam Bark
Hi Joe you can use 1 and just send 'Hi!' as long as something else isn't likely to be sent at the same time. It will just read what is in that socket when you call it so if something else that you don't want is there just behind what you're after then you could end up with that as well.On 8/1/0

Re: [Tutor] Socket Programming

2005-08-01 Thread Joseph Quigley
Hi, Ok. But what if I wanted to send a 1 mb message? Could I leave .recv(1) in and send 'Hi!' as well or would I have to change it? Thanks, JQ Adam Bark wrote: > You have to put in how many bytes of data you want to recieve in > clientsocket.recv() eg. clientsocket.recv(1024) for 1kB.

Re: [Tutor] Socket Programming

2005-08-01 Thread Joseph Quigley
Hi Johan, Johan Geldenhuys wrote: > I have more advanced examples if you want them, but start here and > look at the socket lib and you can start using select if you want to > wait for stuff from the server or client. > > Johan I'd love to see your examples. Could you send them directly to m

Re: [Tutor] Socket Programming

2005-08-01 Thread Adam Bark
You have to put in how many bytes of data you want to recieve in clientsocket.recv() eg. clientsocket.recv(1024) for 1kB.On 7/31/05, Joseph Quigley < [EMAIL PROTECTED]> wrote:Hi Dan, Danny Yoo wrote:>##>clientsocket.recv()>##>>should work better.>>Ok well I tried your examples but they didn

Re: [Tutor] Socket Programming

2005-08-01 Thread Joseph Quigley
Hi Dan, Danny Yoo wrote: >## >clientsocket.recv() >## > >should work better. > > Ok well I tried your examples but they didn't work. I still get: TypeError: recv() takes at least 1 argument (0 given) How can I fix this? ___ Tutor maillist -

Re: [Tutor] Socket Programming

2005-07-31 Thread Kent Johnson
Joseph Quigley wrote: > I have no idea how to get the server to receive and print a message or > for the client to send the message. Does anyone know of some good python > networking tutorials designed for newbies? (Not ones on > www.awaretek.com. They seem to expect you to know some things that

  1   2   >