Hello more trouble from netlib,
I'm attempting to get netlib to communicate with a java socket. I've tried
it both from my machine using a simulator and from somone elses machine and
both times results have been the same I end up with a net error of
4628 which equates to netErrSocketClosedByRemote
Any thoughts on where my problem might lie?
Thanks,
Philip
******************************************
void socketConnect()
{
J9PortLibrary** portLibrary = GLOBAL_DATA(portLibraryGlobal);
Err err;
UInt16 interfaceErrors;
NetSocketAddrINType addr;
UInt16 port = 4444;
char* ipString = "9.26.195.169";
NetIPAddr ipaddress = NetLibAddrAToIN(ipString);
addr.family = netSocketAddrINET;
addr.port = port;
(*portLibrary)->tty_printf(*portLibrary, "ipaddress: %uld, as Short %d\n",
ipaddress, (short)ipaddress);
addr.addr = ipaddress;
(*portLibrary)->tty_printf(*portLibrary, "Attempting Socket Connection...");
err = NetLibSocketConnect(socketRef, (NetSocketAddrType*)&addr,
sizeof(addr), timeout, &interfaceErrors);
if (!err && !interfaceErrors)
(*portLibrary)->tty_printf(*portLibrary, "Ok\n");
else
{
(*portLibrary)->tty_printf(*portLibrary, "Err\n");
(*portLibrary)->tty_printf(*portLibrary,
"err value is %d, err value & netErrorClass %d\n",
err, err & ~netErrorClass);
(*portLibrary)->tty_printf(*portLibrary,
"interfaceError value is %d, %d\n",
interfaceErrors, interfaceErrors & ~netErrorClass);
exit(1);
}
}
At he moment java side code is pretty simple:
public static void main(String[] args) throws InterruptedException
{
ServerSocket serverSock;
try {
serverSock = new ServerSocket(4444);
System.out.println("Waiting for connection on "
+ InetAddress.getLocalHost().getHostAddress());
serverSock.accept();
System.out.println("Connection successful");
serverSock.close();
} catch (IOException e) {
e.printStackTrace();
}
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/