[comp.sys.mac.programmer] losing appletalk packets

roseman@cpsc.ucalgary.ca (Mark Roseman) (05/29/91)

If I've got a DDP socket open, with one DDPRead call pending, and two or three
packets come in before I can get the data and initiate another DDPRead call,
what happens?  Is the extra data lost?  (I assume)

I suspect I may be in this situation.  What are workarounds?  One thought I
had is having multiple DDPRead calls pending at a time on the same socket...
what happens then?  Will an incoming packet chose one of the DDPRead buffers
(the first one?), the next packet another, etc.?  

Any other possible solutions?  Another protocol perhaps?  For my application
I want to have each socket sending and receiving from several other sockets,
so the connection oriented protocols seem unlikely.  

Thanks in advance.

-- 
==============================================================================
Mark Roseman
Dept. of Computer Science, University of Calgary, Calgary, Alta.  T2N 1N4
(403) 220-5769   roseman@cpsc.ucalgary.ca    {ubc-cs|alberta}!calgary!roseman

neeri@iis.ethz.ch (Matthias Ulrich Neeracher) (05/30/91)

In article <1991May29.163624.26494@cpsc.ucalgary.ca> roseman@cpsc.ucalgary.ca (Mark Roseman) writes:
>If I've got a DDP socket open, with one DDPRead call pending, and two or three
>packets come in before I can get the data and initiate another DDPRead call,
>what happens?  Is the extra data lost?  (I assume)

I don't remember much about DDP, but this usually is the semantics of Datagram
protocols.

>Any other possible solutions?  Another protocol perhaps?  For my application
>I want to have each socket sending and receiving from several other sockets,
>so the connection oriented protocols seem unlikely.  

As far as I know, ADSP allows you to send and receive from one socket to
several others. Another possibility is to use ATP.

Matthias

-----
Matthias Neeracher                                      neeri@iis.ethz.ch
   "These days, though, you have to be pretty technical before you can 
    even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_

kurash@carr (Mark Valence) (05/30/91)

In article <1991May29.163624.26494@cpsc.ucalgary.ca> roseman@cpsc.ucalgary.ca (Mark Roseman) writes:
>If I've got a DDP socket open, with one DDPRead call pending, and two or three
>packets come in before I can get the data and initiate another DDPRead call,
>what happens?  Is the extra data lost?  (I assume)
>

Yup, that's what happens if you are not quick enough.

>I suspect I may be in this situation.  What are workarounds?  One thought I
>had is having multiple DDPRead calls pending at a time on the same socket...
>what happens then?  Will an incoming packet chose one of the DDPRead buffers
>(the first one?), the next packet another, etc.?  
>

Workarounds later, first, a note on DDPRead.  DDPRead is a glue routine
supplied by your development system; there is no corresponding "PBDDPRead"
for the MPP driver (i.e. the AppleTalk internals).  For this reason, you
will not be able to "queue up" a bunch of DDPReads on one socket, like you
can with ATP or other protocols.  Details if you want them.

So, now what are the workarounds?  First, you could be quicker about reading
the data into your buffers.  One way to do this is to multiplex buffers your-
self in a completion routine.  Actually, this is quite easy.

Another way would be to scrap DDPRead altogether, and implement a socket
listener.  This is a bit trickier to do, but it ain't impossible.

>Any other possible solutions?  Another protocol perhaps?  For my application
>I want to have each socket sending and receiving from several other sockets,
>so the connection oriented protocols seem unlikely.  
>

Yup, I guess if you want low-overhead, you are kind of stuck.  If you are
sending request/response transactions, use ATP.  No sessions, and retransmits
are built in.  If your traffic is more stream oriented, you might have to
do some heavy DDP stuff, as ADSP is session-heavy.  Of course, if you do not
mind using alot of memory for alot of session CBs, then use ADSP.  You can then
also remember which set of sockets belongs to each of your objects.

Another thing to consider is another part to your network address, call it
a port or something.  Then, you could use ADSP, ATP, ASP, whatever, to do
your communication.  Open one socket for each object, assign it a bunch of
port numbers (just make them up, your making your own protocol here), and
send the port number in each packet.  Then when you get a packet, grab
the port number and hand it to the right routine (buffer, whatever).  Of
course, you will break the streamness of ADSP if you use this method, but
ATP survives, as does ASP.

I hope that's not too complicated.  Why multiple sockets, anyway?  There
is a per-machine limit, and there WILL be other programs wanting to use
one of two sockets...



>Thanks in advance.
>
>-- 
>==============================================================================
>Mark Roseman
>Dept. of Computer Science, University of Calgary, Calgary, Alta.  T2N 1N4
>(403) 220-5769   roseman@cpsc.ucalgary.ca    {ubc-cs|alberta}!calgary!roseman

Mark.