473,399 Members | 3,919 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,399 software developers and data experts.

looking for UDP package, network programming guidance

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 testing
software written in Delphi, all of which I have access to. The
hardware communicates with the PC via UDP.

I've been working on porting the PC "test" software to Python so
that 1) I understand the code, 2) don't need to go buy Delphi to
help this guy out, and 3) learn enough about network programming
to write the actual application interface software for off-the-
shelf software to use this hardware. I spent a bunch of hours
one night learning everything I needed to about wxPython to get a
not-so-fancy but needs-a-lot-of-different-UI-elements test app UI
running, but now the stumbling block comes up that Python doesn't
seem to have any UDP handling built into its distribution.

Searching the web turned up Twisted, although it seems like it
might be a bit bigger than I would have hoped (in terms of,
"there's a huge package here to figure out"), but as far as I can
tell it's the only UDP solution out there. Is this the case?

Additionally, the networking protocol is a fixed format packed
bytes sort of thing; is it easy enough in Python (with Twisted)
to read bytes off of the stream and then decide what to do with
them? (I'm a Python newbie but somewhat of a C++ pro.)

Finally, I'm also somewhat of a babe in the woods with network
programming in general. Any good references for learning about
this stuff, something that goes over issues of robustness, error
handling strategies, and so forth? It'd be best if anything had
"tutorials" written in Python, of course. ;)

thanks,
-tom!
Jul 18 '05 #1
3 2348
On Monday 07 July 2003 10:43, Gerhard Häring wrote:
Any good references for learning about
this stuff, [...]


Sorry, not that I knew of. There is a (very short) Python Socket
Programming Tutorial, but it only covers the very basics. Probably there
is some good material out there for doing socket programming in C which
you could easily map to Python, because the concepts and even the names
of the functions are pretty much the same.


W. Richard Stevens' "UNIX Network Programming" covers sockets in depth and is
one of the authoritative texts on the subject.

Yes, it is C. However the sockets API pretty much works the same in every
language.
Jul 18 '05 #2
Tom Plunket wrote:
...now the stumbling block comes up that Python doesn't seem to
have any UDP handling built into its distribution.

Thanks a lot for the pointers, gang. Hopefully I can get
something up and running in the next couple of days (or rather,
the next time I have a couple of uninterrupted hours for this
task), so these pointers will send me in the right direction.

I definitely like the idea of a lower level solution, so this is
nice. For whatever reason, my web search turned up info related
only to win32all, so I assumed... :)

Anyway, off to get this going. :)
-tom!
Jul 18 '05 #3
On Mon, 07 Jul 2003, Tom Plunket <to***@fancy.org> wrote:
Searching the web turned up Twisted, although it seems like it
might be a bit bigger than I would have hoped (in terms of,
"there's a huge package here to figure out"), but as far as I can
tell it's the only UDP solution out there. Is this the case?


It isn't the only one, but it makes it fairly easy to write UDP
servers without worrying about the irrelevant low-level details.

Here is a simple example, based on an example from the UDP howto:
'''
from twisted.internet import protocol, reactor
class UpperEcho(protocol.DatagramProtocol):
def datagramReceived(self, data, (host, port)):
self.transport.write(data.upper(), (host, port))

reactor.listenUDP(9999, UpperEcho())
reactor.run()
'''

Run the above in the Python interpreter, and then in a different window:

moshez@green:~$ echo hello | nc -u localhost 9999
HELLO

Granted, perhaps not the most efficient way to uppercase strings,
but hopefully I got the idea across.

Despite Twisted's "largeness", you can usually limit yourself to
the howto you're interested in, and read others only as they come
in useful.
[If you have further Twisted questions, the Twisted mailing list
is the best forum to ask in.]
--
Moshe Zadka -- http://moshez.org/
Buffy: I don't like you hanging out with someone that... short.
Riley: Yeah, a lot of young people nowadays are experimenting with shortness.
Agile Programming Language -- http://www.python.org/

Jul 18 '05 #4

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

Similar topics

1
by: Jeff Yoshimi | last post by:
Hi, I am currently redesigning some code of mine and trying to determine the best way to "package" it. So far I've been doing this more or less blindly, so I thought I'd consult this group. ...
0
by: Matt | last post by:
Hello, I am attempting to get a software prototype UI/demo built in Flash to talk with existing C++ (so I can exchange data and commands between the application-software already developed in the...
6
by: PHLICS_Admin | last post by:
Hi All, There are two network cards in one computer (named A) , and there is one network card in another computer(named B). On computer A: one network card is used to connect to internet, and...
3
by: Peter Afonin | last post by:
Hello, Our SQL server used to run under System account, and I had no problems executing DTS packages from the ASP.NET: Dim oPkg As DTS.Package oPkg = CreateObject("DTS.Package")...
2
by: Dan Tallent | last post by:
I need to design a server application that will handle an unknown number of clients. (currently 25+) The initial plan was to create a new TCP socket connection for each client. When the client...
7
by: Robert Seacord | last post by:
The CERT/CC has just deployed a new web site dedicated to developing secure coding standards for the C programming language, C++, and eventually other programming language. We have already...
4
by: John Henry | last post by:
I am looking for a ready made simple graph package. I found an extensive one in the piana package but when I try to use just the graph portion, it fails to load because of the line: class...
20
by: piggy | last post by:
I have developed an application using C# under .NET 2.0 framework. It is almost done and it is time for me to think about deploymnet to all users. I don't have any background about this and would...
12
by: amogan | last post by:
**If interested & qualified, please reply with your resume directly to amogan@google.com** Referrals are always welcome!! Network System Test Engineer - Mountain View This position is...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.