Network Programming in Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • diffuser78@gmail.com

    #1

    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.

  • Fredrik Lundh

    #2
    Re: Network Programming in Python

    diffuser78@gmai l.com wrote:
    [color=blue]
    > 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.[/color]

    server:



    client:

    Source code: Lib/xmlrpc/client.py XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP(S) as a transport. With it, a client can call methods with parameters on a remote server (t...


    </F>

    Comment

    • diffuser78@gmail.com

      #3
      Re: Network Programming in Python

      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:[color=blue]
      > diffuser78@gmai l.com wrote:
      >[color=green]
      > > 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.[/color]
      >
      > server:
      >
      > http://docs.python.org/lib/module-Si...RPCServer.html
      >
      > client:
      >
      > http://docs.python.org/lib/module-xmlrpclib.html
      >
      > </F>[/color]

      Comment

      • tactics40@gmail.com

        #4
        Re: Network Programming in Python

        diffuser78@gmai l.com wrote:[color=blue]
        > I am a newbie in python. I want to learn and implement a small
        > networking concept. Please help me. Every help is appreciated.[/color]

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


        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.

        Comment

        • Fredrik Lundh

          #5
          Re: Network Programming in Python

          diffuser78@gmai l.com wrote:
          [color=blue]
          > Thanks...I will read that up...could you give me some more headstart or
          > if you any sample code which I can study.[/color]

          both chapters I pointed you to contain examples.

          </F>

          Comment

          • diffuser78@gmail.com

            #6
            Re: Network Programming in Python

            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:[color=blue]
            > On 22 Jun 2006 12:02:14 -0700, diffuser78@gmai l.com wrote:[color=green]
            > >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.
            > >[/color]
            >
            > Untested:
            >
            > from twisted.interne t import protocol, reactor
            > from twisted.protoco ls import basic
            >
            > COMMANDS = {
            > "xterm": ("/usr/bin/xterm", {"DISPLAY": ":1.0"}),
            > }
            >
            > class CommandLauncher (basic.LineRece iver):
            > def lineReceived(se lf, line):
            > try:
            > cmd, env = COMMANDS[line]
            > except KeyError:
            > self.sendLine(" error")
            > else:
            > reactor.spawnPr ocess(None, cmd, env=env)
            > self.sendLine(" okay")
            >
            > f = protocol.Server Factory()
            > f.protocol = CommandLauncher
            > reactor.listenT CP(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[/color]

            Comment

            • Irmen de Jong

              #7
              Re: Network Programming in Python

              tactics40@gmail .com wrote:[color=blue]
              >
              > 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.[/color]

              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


              Comment

              • Bruno Desthuilliers

                #8
                Re: Network Programming in Python

                diffuser78@gmai l.com a écrit :[color=blue]
                > I have Python 2.4.2 on windows and Linux both. I got an import error.
                > how can we obtain the twisted libraries ?[/color]

                Is google down ?

                Comment

                • diffuser78@gmail.com

                  #9
                  Re: Network Programming in Python

                  I got it ...initially sourceforge page linked all old libraries..late r
                  then got this link to twistedmatrix. Thanks.
                  Bruno Desthuilliers wrote:[color=blue]
                  > diffuser78@gmai l.com a écrit :[color=green]
                  > > I have Python 2.4.2 on windows and Linux both. I got an import error.
                  > > how can we obtain the twisted libraries ?[/color]
                  >
                  > Is google down ?[/color]

                  Comment

                  • Cameron Laird

                    #10
                    Re: Network Programming in Python

                    In article <1151006542.682 915.83500@c74g2 000cwc.googlegr oups.com>,
                    <diffuser78@gma il.com> wrote:[color=blue]
                    >I have Python 2.4.2 on windows and Linux both. I got an import error.
                    >how can we obtain the twisted libraries ?[/color]

                    Comment

                    • Bill Maxwell

                      #11
                      Re: Network Programming in Python

                      On 22 Jun 2006 12:02:14 -0700, diffuser78@gmai l.com wrote:
                      [color=blue]
                      >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.[/color]


                      Have you checked out Pyro (Python Remote Objects)?



                      Bill



                      Comment

                      • diffuser78@gmail.com

                        #12
                        Re: Network Programming in Python

                        I just realized that you are the author of Pyro. Will it be of any help
                        to me ??

                        Irmen de Jong wrote:[color=blue]
                        > tactics40@gmail .com wrote:[color=green]
                        > >
                        > > 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.[/color]
                        >
                        > 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[/color]

                        Comment

                        • diffuser78@gmail.com

                          #13
                          Re: Network Programming in Python

                          How will Pyon help my cause ?

                          Bill Maxwell wrote:[color=blue]
                          > On 22 Jun 2006 12:02:14 -0700, diffuser78@gmai l.com wrote:
                          >[color=green]
                          > >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.[/color]
                          >
                          >
                          > Have you checked out Pyro (Python Remote Objects)?
                          >
                          > http://pyro.sourceforge.net/
                          >
                          > Bill[/color]

                          Comment

                          • Grant Edwards

                            #14
                            Re: Network Programming in Python

                            On 2006-06-23, diffuser78@gmai l.com <diffuser78@gma il.com> wrote:
                            [color=blue]
                            > How will Pyon help my cause ?[/color]

                            What's Pyon?

                            --
                            Grant Edwards grante Yow! We are now enjoying
                            at total mutual interaction in
                            visi.com an imaginary hot tub...

                            Comment

                            • Cameron Laird

                              #15
                              Re: Network Programming in Python

                              In article <129o2p1l314957 9@corp.supernew s.com>,
                              Grant Edwards <grante@visi.co m> wrote:[color=blue]
                              >On 2006-06-23, diffuser78@gmai l.com <diffuser78@gma il.com> wrote:
                              >[color=green]
                              >> How will Pyon help my cause ?[/color]
                              >
                              >What's Pyon?[/color]

                              Comment

                              Working...