[aus.mac] DDPOpenSocket problem in LSC

luke@tasis.utas.oz (Luke Visser) (07/18/88)

	Can someone pick what I'm doing wrong in calling DDPOpenSocket from 
LSC.  As far as I can tell I'm not doing anything incorrectly and so 
I think the problem is in LSC.

	I'm attempting to set up some DDPReads.  In IM II it descibes having
to open a socket first so I do that, this returns no error but doesn't quite
do what the description in IM says it should do.  Here's the code segment.

	#define nil -0L
	Byte mynamesocket = 0;
	ABRecHandle theabhdle;
	...
	if (DDPOpenSocket(&mynamesocket, nil) == noErr) {
		theabhdle = (ABRecHandle) NewHandle(ddpSize);
		(**theabhdle).ddpProto.ddpSocket = mynamesocket;
		(**theabhdle).ddpProto.ddpReqCount = 10;
		(**theabhdle).ddpProto.ddpDataPtr = NewPtr(10);
		DDPRead(theabhdle, FALSE, ASYNC);
	}

	Ok, in theory if I pass 0 to DDPOpenSocket it should dynamically
allocate a socket (in the range 128 to 254) but it doesn't, it allocates me
socket number 0, so I changed that to 90 - no hassles, allocates me socket
number 90 (at least as far as I'm aware, I don't get any errs or contrary
indication).
	So I have an open socket with the standard socket listener listening.
If I dump out the err returned by DDPRead I get -3105 which is 'Socket or
protocol type invalid or not found in table'.  I've checked my code against
some working MPW Pascal code (that does the same) and it looks syntactically
the same, however mine doesn't work.  Also some LSP code which does the same
works ok.
	My only sensible deduction is that DDPOpenSocket is not doing what
it should be doing.  Is this because I'm calling it incorrectly or because
the call is not implemented correctly.

	To me the problem seems to run along the lines of the definition
of DDPOpenSocket being declared:

	OSErr DDPOpenSocket(theSocket, sktListener)
	Byte theSocket;
	Ptr sktListener;

instead of

	OSErr DDPOpenSocket(theSocket, sktListener)
	Byte *theSocket;
	Ptr sktListener;

this is consistent with the problems I'm having, in fact it may actually
be opening a socket for me but I wouldn't have the foggiest as to what
the number it is because it's not returning it properly.

Luke Visser.
---------------------------------------------------------------------------
Snail: Uni of Tasmania, Box 252C GPO, Hobart 7001, Tasmania, Australia.
ACSnet: luke@tasis.utas.oz	ARPA: luke%tasis.utas.oz@uunet.uu.net
UUCP: {enea,hplabs,mcvax,uunet,ukc}!munnari!tasis.utas.oz!luke