Hi all,
I have a problem on sending data from my Tungsten W to my PC Win2000 with
ADSL.
I've written a small apps with CW8 for Tunsgten W which "allow" me to send
data from the TW to another small apps (Delphi 7) running on Win2000 called
NetChat. All NetChat does is listening on it's ADSL IP address (port 5000)
and display everything received. This program runs well on local network.
Here's the TW code for sending data :
static Err MySendSocket ( char *aIPAddress, UInt16 aPort, NetSocketRef
aSocketID, char *aString )
{
NetSocketAddrINType lstAddrINType;
Err lError, lInterfaceError;
lstAddrINType.family = netSocketAddrINET;
lstAddrINType.port = aPort;
lstAddrINType.addr = NetLibAddrAToIN ( AppNetRefnum, aIPAddress );
lError = NetLibSend ( AppNetRefnum, aSocketID, aString, strlen
(aString), netIOFlagOutOfBand | netIOFlagDontRoute,
( NetSocketAddrType*)&lstAddrINType,
sizeof(lstAddrINType), TIMEOUT, &lInterfaceError );
if ( lInterfaceError ) printf ( "ERROR on MySendSocket::NetLibSend\n" );
return lError;
}
static void AppEventLoop(void)
{
NetSocketRef lSocketID;
UInt16 lError, lCounter, lSendCounter;
EventType lEvent;
char lBuffer[80], lIPAddress[20];
lCounter = 0;
lSocketID = MyConnectSocket ( "81.81.xxx.xxx", 5000 );
do
{
// change timeout if you need periodic nilEvents
EvtGetEvent ( &lEvent, 20 );
// sending strings to the port
if ( ( lSocketID > 0 ) && ( lCounter < 2 ) )
{
sprintf ( lBuffer, "Hello NetBST %d\n", lCounter++ );
lSendCounter = MySendSocket ( IP_TRANSADAPT, 5000, lSocketID,
lBuffer );
if ( lSendCounter < 0 ) printf ( "ERROR on Send : %d\n",
lSendCounter );
else printf ( "Sending :
%s\n", lBuffer );
}
...........
} while ( lEvent.eType != appStopEvent );
MyCloseSocket ( lSocketID );
}
The initialisation sequence runs well, no errors returned. The same thing
for "MyConnectSorcket", no error returned.
I have tried to open the socket with
- AF_INET and SOCK_RAW and netSocketProtoIPRAW -> no error
- AF_INET and SOCK_DGRAM and 0 -> no error
- AF_INET and SOCK_STREAM and 0 returned error "netErrParamErr"
The buffer is sent correctly "Sending : Hello NetBST %1 ...etc", but NetChat
received nothing at all. Why ? Is there something to configure on the Palm
proxy ? and How
Is there any small apps out there which allow me to listen a specified IP
address and port, and display incomings to the screen ?
All suggestions are welcome
Thanks a lot in advance.
--
Agus
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/