473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Network Programming in Python

I am a newbie in python. I want to learn and implement a small
networking concept. Please help me. Every help is appreciated.

I have one Linux Box and one Windows PC. I want to have a daemon
running on Windows PC which listens on some specicif port number. I
want to send a TCP/IP or UDP/IP packet from Linux box to Windows PC to
start some application. As Windows PC recieves such a packet from Linux
Box it executes a certain .exe file. I want to implement this concept.

In short I want to remotely send command from Linux to Windows PC to
start a particular application.

Thanks, Every help is appreciated.

Jun 22 '06 #1
15 1433
di********@gmail.com wrote:
I am a newbie in python. I want to learn and implement a small
networking concept. Please help me. Every help is appreciated.

I have one Linux Box and one Windows PC. I want to have a daemon
running on Windows PC which listens on some specicif port number. I
want to send a TCP/IP or UDP/IP packet from Linux box to Windows PC to
start some application. As Windows PC recieves such a packet from Linux
Box it executes a certain .exe file. I want to implement this concept.

In short I want to remotely send command from Linux to Windows PC to
start a particular application.


server:

http://docs.python.org/lib/module-Si...RPCServer.html

client:

http://docs.python.org/lib/module-xmlrpclib.html

</F>

Jun 22 '06 #2
Thanks...I will read that up...could you give me some more headstart or
if you any sample code which I can study.

Thanks for your help, every help is appreciated
Fredrik Lundh wrote:
di********@gmail.com wrote:
I am a newbie in python. I want to learn and implement a small
networking concept. Please help me. Every help is appreciated.

I have one Linux Box and one Windows PC. I want to have a daemon
running on Windows PC which listens on some specicif port number. I
want to send a TCP/IP or UDP/IP packet from Linux box to Windows PC to
start some application. As Windows PC recieves such a packet from Linux
Box it executes a certain .exe file. I want to implement this concept.

In short I want to remotely send command from Linux to Windows PC to
start a particular application.


server:

http://docs.python.org/lib/module-Si...RPCServer.html

client:

http://docs.python.org/lib/module-xmlrpclib.html

</F>


Jun 22 '06 #3
di********@gmail.com wrote:
I am a newbie in python. I want to learn and implement a small
networking concept. Please help me. Every help is appreciated.


(hums the Batman Theme song replacing the words Batman with Google)...

http://www.amk.ca/python/howto/sockets/
http://www.devshed.com/c/a/Python/Sockets-in-Python/

Really, was that so hard?

Python makes sockets a total breeze. You can write an 80's style HTTP
server in less than a page of code.

Jun 22 '06 #4
di********@gmail.com wrote:
Thanks...I will read that up...could you give me some more headstart or
if you any sample code which I can study.


both chapters I pointed you to contain examples.

</F>

Jun 22 '06 #5
I have Python 2.4.2 on windows and Linux both. I got an import error.
how can we obtain the twisted libraries ?

When I try to run your code
Jean-Paul Calderone wrote:
On 22 Jun 2006 12:02:14 -0700, di********@gmail.com wrote:
I am a newbie in python. I want to learn and implement a small
networking concept. Please help me. Every help is appreciated.

I have one Linux Box and one Windows PC. I want to have a daemon
running on Windows PC which listens on some specicif port number. I
want to send a TCP/IP or UDP/IP packet from Linux box to Windows PC to
start some application. As Windows PC recieves such a packet from Linux
Box it executes a certain .exe file. I want to implement this concept.

In short I want to remotely send command from Linux to Windows PC to
start a particular application.

Thanks, Every help is appreciated.


Untested:

from twisted.internet import protocol, reactor
from twisted.protocols import basic

COMMANDS = {
"xterm": ("/usr/bin/xterm", {"DISPLAY": ":1.0"}),
}

class CommandLauncher(basic.LineReceiver):
def lineReceived(self, line):
try:
cmd, env = COMMANDS[line]
except KeyError:
self.sendLine("error")
else:
reactor.spawnProcess(None, cmd, env=env)
self.sendLine("okay")

f = protocol.ServerFactory()
f.protocol = CommandLauncher
reactor.listenTCP(12345, f)
reactor.run()

You should be able to telnet to this (port 12345) and type in
names of commands for it to run. Of course, xterm isn't a very
good win32 program to run but I couldn't think of a better example.
You could also write a program to send command requests to this
server, instead of using telnet.

Jean-Paul


Jun 22 '06 #6
ta*******@gmail.com wrote:

Really, was that so hard?

Python makes sockets a total breeze. You can write an 80's style HTTP
server in less than a page of code.


But making a *good* 80's style http/socket server is a lot of work.
Better pick one of the high level protocols built on top of it,
to shield you from the gory details of raw socket programming.

--Irmen
Jun 22 '06 #7
di********@gmail.com a écrit :
I have Python 2.4.2 on windows and Linux both. I got an import error.
how can we obtain the twisted libraries ?


Is google down ?
Jun 22 '06 #8
I got it ...initially sourceforge page linked all old libraries..later
then got this link to twistedmatrix. Thanks.
Bruno Desthuilliers wrote:
di********@gmail.com a écrit :
I have Python 2.4.2 on windows and Linux both. I got an import error.
how can we obtain the twisted libraries ?


Is google down ?


Jun 22 '06 #9
In article <11*********************@c74g2000cwc.googlegroups. com>,
<di********@gmail.com> wrote:
I have Python 2.4.2 on windows and Linux both. I got an import error.
how can we obtain the twisted libraries ?

Jun 22 '06 #10
On 22 Jun 2006 12:02:14 -0700, di********@gmail.com wrote:
I am a newbie in python. I want to learn and implement a small
networking concept. Please help me. Every help is appreciated.

I have one Linux Box and one Windows PC. I want to have a daemon
running on Windows PC which listens on some specicif port number. I
want to send a TCP/IP or UDP/IP packet from Linux box to Windows PC to
start some application. As Windows PC recieves such a packet from Linux
Box it executes a certain .exe file. I want to implement this concept.

In short I want to remotely send command from Linux to Windows PC to
start a particular application.

Have you checked out Pyro (Python Remote Objects)?

http://pyro.sourceforge.net/

Bill

Jun 23 '06 #11
I just realized that you are the author of Pyro. Will it be of any help
to me ??

Irmen de Jong wrote:
ta*******@gmail.com wrote:

Really, was that so hard?

Python makes sockets a total breeze. You can write an 80's style HTTP
server in less than a page of code.


But making a *good* 80's style http/socket server is a lot of work.
Better pick one of the high level protocols built on top of it,
to shield you from the gory details of raw socket programming.

--Irmen


Jun 23 '06 #12
How will Pyon help my cause ?

Bill Maxwell wrote:
On 22 Jun 2006 12:02:14 -0700, di********@gmail.com wrote:
I am a newbie in python. I want to learn and implement a small
networking concept. Please help me. Every help is appreciated.

I have one Linux Box and one Windows PC. I want to have a daemon
running on Windows PC which listens on some specicif port number. I
want to send a TCP/IP or UDP/IP packet from Linux box to Windows PC to
start some application. As Windows PC recieves such a packet from Linux
Box it executes a certain .exe file. I want to implement this concept.

In short I want to remotely send command from Linux to Windows PC to
start a particular application.

Have you checked out Pyro (Python Remote Objects)?

http://pyro.sourceforge.net/

Bill


Jun 23 '06 #13
On 2006-06-23, di********@gmail.com <di********@gmail.com> wrote:
How will Pyon help my cause ?


What's Pyon?

--
Grant Edwards grante Yow! We are now enjoying
at total mutual interaction in
visi.com an imaginary hot tub...
Jun 23 '06 #14
In article <12*************@corp.supernews.com>,
Grant Edwards <gr****@visi.com> wrote:
On 2006-06-23, di********@gmail.com <di********@gmail.com> wrote:
How will Pyon help my cause ?


What's Pyon?

Jun 23 '06 #15
On 2006-06-23, Cameron Laird <cl****@lairds.us> wrote:
In article <12*************@corp.supernews.com>,
Grant Edwards <gr****@visi.com> wrote:
On 2006-06-23, di********@gmail.com <di********@gmail.com> wrote:
How will Pyon help my cause ?


What's Pyon?

.
.
.
A misreading of "Pyro". Pyro <URL: http://pyro.sourceforge.net/ >,
of course, is yet another communications layer, but, as was suggested,
one that might particularly suit Mr. Johnson.


Ah! I think I've always mixed up pyrex and pyro and psco, and
never actually new what Pyro really was. I've got it straight
now (how long I'll keep the three of them striaght in my head
is another question).

--
Grant Edwards grante Yow! BARBARA STANWYCK
at makes me nervous!!
visi.com
Jun 23 '06 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tom Plunket | last post by:
Hey all- A friend of mine has built this interesting (to me) bit of hardware that's intended to communicate with a PC over ethernet. The hardware has an OS written in C, and has some PC-side...
1
by: christopher | last post by:
Is there a network programming list for Python? I primarily use python for network programming, and the amount of traffic on this list is overwhelming, as there are a bunch of topics regarding the...
1
by: mch2k2 | last post by:
Hello All I have just started working on Pyhton. I need urgent help regarding Python Network Programming. I want the elctronic version of the Book: Foundations of Python Network programming by...
6
by: John Walton | last post by:
Hello, everyone. I just began school, and they already assigned us science fair. Since I'm in 8th grade, I get to do demonstrations for our projects. I'm probably going to demonstrate Python's...
1
by: John Walton | last post by:
Hello. It's me again. Thanks for all the help with the Python Networking Resources, but does anyone know what I'll need to know to write a paper on Network Programming and Python. Like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.