On 2006-07-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi Jeff,
>
> Regarding the code, i initialized using the code below for a UDP server:
> after loading the net lib
> NetLibP->MasterSocket = NetLibSocketOpen (NetLibP->AppNetRefnum,
>               netSocketAddrINET,
>               netSocketTypeDatagram,
>               netSocketProtoIPUDP,
>               NetLibP->AppNetTimeout,
>               &err);
> NetLibP->MasterAddrSize = sizeof(NetLibP->MasterAddr);
>               MemSet(&NetLibP->MasterAddr,
>                 sizeof(NetLibP->MasterAddr), 0);
>               NetLibP->MasterAddr.family = netSocketAddrINET;
>               NetLibP->MasterAddr.port = NetHToNS(Port);
>               NetLibP->MasterAddr.addr = NetHToNL(GetIPAddr(NetLibP));
> NetLibSocketBind (NetLibP->AppNetRefnum,
>               NetLibP->MasterSocket,
>               (NetSocketAddrType *)&NetLibP->MasterAddr,
>               sizeof(NetLibP->MasterAddr),
>               NetLibP->AppNetTimeout,
>               &err);
> err = SetSocketBlocking(NetLibP, MasterSocketType, false);
>
> using the initilization above i was able to receive messages using
> NetLibRecieve, but once i tries to send a message using netlibsend,
> value of -1 is returned and the error this contains netErrSocketNotConnected.
>
> but before i got the netErrWouldBlock, i dnt know why right now the error
> is netErrSocketNotConnected.
>

I would suggest you read a few articles/books about tcp/ip prgramming.
Google for 'tcpip introduction' and you will find plenty. Read some client
and server programming examples.
The NetLib implementation follows the original Berkeley sockets very
closely (as do most tcpip implementations).

Anyway in your case, when you have a server socket listening for incoming 
connections (which is what you have, since you use NetLibSocketBind) you 
cannot use the same socket to send stuff. You need to create a new 
socket.

HTH

Ton van Overbeek


-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to