Client/server application in Python

52 views
Skip to first unread message

pdbarnes

unread,
May 28, 2014, 5:56:06 PM5/28/14
to ns-3-...@googlegroups.com
Hello Folks,

We'd like to write an client/server application pair entirely in Python.  Cribbing from the C++ implementations of OnOffApplication and PacketSink, we imagine something like

class MyApp(ns3.Application):

 
def Start(self):
   
# _socket is meant to be a private member of MyApp
   _socket
= ns3.Socket
   _socket
.SetRecvCallback(self.Receive)

 
def Send(self):
   
# Protocol header
   header
= ...
   
# Size of data packet we need
   size
= header.GetSerializedSize()
   packet
= ns3.network.Packet(size)
   packet
.AddHeader(header)
   _socket
.Send(packet)

 
def Receive(self, packet):
   packet
= _socket.Recv()
   
...

Does this seem feasible? Could anyone point us to a working example along these lines?  Or another approach?

Thanks,
Peter

Sergio Cabrero Barros

unread,
Dec 10, 2014, 10:14:43 AM12/10/14
to ns-3-...@googlegroups.com
Hello Peter (and all), 

I was thinking on doing something similar. Have you managed to build a python custom application? Is there any answer to this?

Best regards,
Sergio

Peter Barnes

unread,
Jan 23, 2015, 11:30:02 PM1/23/15
to ns-3-...@googlegroups.com
Hello Sergio,

Sorry I've taken so long to reply.  No we haven't tried this.  It came up for us as a possible way approach in another domain, so we wondered if this was even possible.

Let me know if you get something working; I'd be interested.

Thanks,
Peter

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/Of_g2in8Kgc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

____________
Peter Barnes
pd...@mac.com

Reply all
Reply to author
Forward
0 new messages