473,503 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: asyncore/asynchat and terminator string

I'm implementing a relatively simple inter-application communication
system that uses asyncore/asynchat to send messages back and forth.

The messages are prefixed by a length value and terminator string, to
signal that a message is incoming, and an integer value specifying the
size of the message, followed by the message data.

My question is: how can I produce a short terminator string that won't
show up (or has an extremely small chance of showing up) in the binary
data that I send as messages?

Frankly, I'm not so sure this is even an important question, but is
nagging me. If my communication is a kind of state machine:

sender: sends message length value, followed by terminator string,
followed by message data
receiver: waiting for terminator string via set_terminator(<terminator
string>)
continually save what comes in via collect_incoming_data()
receiver: when sender's message arrives, found_terminator() is called
pull message length from previously received data
set terminator to be the length of the message via
set_terminator(<message length>)
receiver: collect_incoming_data() collects the message data
receiver: found_terminator() called when full message length is read,
receiver goes back to waiting for message terminator string

I hope I explained that clearly enough.

The only time I can conceive that the system will get confused by
finding a terminator string in the binary data of the message is if
something goes haywire and I end up looking for a terminator string when
the other side is sending the message data. What gotchas do I need to
look out for here? I'm not a networking person, so I'm relying on the
underlying libraries to be stable and just let me handle the high-level
stuff here. This isn't going to be used in a malicious environment, the
only thing I have to contend with is network hiccups...nobody is
actively going to try and break this system.

Any advice/help would be appreciated,
-Dave

--
Presenting:
mediocre nebula.

Jan 16 '07 #1
0 1150

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

Similar topics

0
2690
by: Michael Welsh | last post by:
In order to learn sockets in Python I am trying to write a simple group chat server and client. I need a little nudge, please. My question contains some GUI but only as decoration. The root...
4
2933
by: F.G.Testa | last post by:
Hi! Is there a way to access a specific connected socket when using a derived asyncore.dispatcher and derived asynchat.async_chat? class AcmeServer(asyncore.dispatcher): def __init__(self,...
1
1933
by: fishboy | last post by:
Howdy, I'm in middle of a personal project. Eventually it will download multipart binary attachments and look for missing parts on other servers. And so far I've got it to walk a newsgroup and...
4
3002
by: Joshua Moore-Oliva | last post by:
Ok.. so here is my situation. I have an application that I would love to be able to use asynchat with for it's handle_close, found_terminator etc abstraction on. However, I must use a separate...
3
3644
by: Jos | last post by:
Hello. I'm using the asyncore and _chat modules to create a network server. I also have, running in a separate thread(s), a "producer" which needs to "push" data onto the network connection(s)....
0
1286
by: Z. Kotzer | last post by:
I can not get error notifications when an asynchat based client tries to connect to a non-responsive address. To validate the problem I changed lib/test/test_asynchat.py as follows: class...
7
2640
by: Paul Kozik | last post by:
I am working on the networking code for a small Multiplayer RPG I'm working on. I currently have some basic code using threads, but it seems like asyncore would be far better suited for my needs....
0
1090
by: Giampaolo Rodola' | last post by:
Hi, I post this message here in the hope someone using asyncore could review this. Since the thing I miss mostly in asyncore is a system for calling a function after a certain amount of time, I...
8
2614
by: Frank Millman | last post by:
Hi all I have been using my own home-brewed client/server technique for a while, using socket and select. It seems to work ok. The server can handle multiple clients. It does this by creating a...
0
7205
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
7353
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...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5596
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,...
1
5023
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...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.