--- Basil Daoust <[EMAIL PROTECTED]> wrote:
> >From Google search
>
> Abbreviated UDP, a connectionless protocol that,
> like TCP, runs on top of
> IP networks. Unlike TCP/IP, UDP/IP provides very few
> error recovery
> services, offering instead a direct way to send and
> receive datagrams over
> an IP network. It's used primarily for broadcasting
> messages over a
> network.
>
> In the end it means your responsible for tracking
> lost messages they won't
> be retried.
However -in this case it took me a while to get
someone to help develop the JAVA server side of this -
I would then have to request they re-tool it to be a
UDP socket server instead of a TCP socket server -
correct? I know this is easy in perl - just
specifiying the proto=> option - but I am not sure
what it would take on the JAVA side to do this - or
would it require changing how the socket in/out is
currently handled in the JAVA code now?
Here is some of the code from the JAVA code that is
setup to do the TCP socket server connection and the
connection to our software (not all of it - I left out
what I thought was not relevant)
I don't see anything that specifies the protocol
though?
--------------------
import com.sdrc.openideas.OI_ErrorCodes;
import com.sdrc.openideas.OI_GUIServer;
import com.sdrc.openideas.OI_ListRegion;
import com.sdrc.openideas.OI_Server;
import com.sdrc.openideas.OI_CommandServer;
import com.sdrc.openideas.util.OI_CommandWait;
import com.sdrc.openideas.OI_AccessControlServer;
import com.sdrc.openideas.OI_IdmItem;
import com.sdrc.openideas.OI_Bin;
import com.sdrc.openideas.OI_Container;
import com.sdrc.openideas.OI_ModelFile;
import com.sdrc.openideas.OI_ModelingItem;
import com.sdrc.openideas.OI_Part;
import com.sdrc.openideas.OI_Assembly;
import com.sdrc.openideas.OI_Drawing;
import com.sdrc.openideas.OI_LegacyDrawing;
import com.sdrc.openideas.OI_FEModel;
import com.sdrc.openideas.OI_State;
import com.sdrc.openideas.OI_DataInstallation;
import com.sdrc.openideas.OI_IdmAttribute;
import com.sdrc.openideas.OI_IdmAttributeDefinition;
import com.sdrc.openideas.OI_IdmAttributePackage.*;
import com.sdrc.openideas.OID_GET_LATEST_VERSION;
import com.sdrc.openideas.OID_GET_ALL_VERSIONS;
import com.sdrc.openideas.util.*;
import org.omg.CORBA.*;
import java.io.*;
import java.net.*;
/**
* This program is a very simple socket communication
program.
* The application will connect to the I-DEAS session,
open a named socked and
* wait for input from the socket. It has a 5 minute
time out after which
* it will exit.
*
* I-DEAS Version : 11
*
*/
public class OI_SocketServer
extends OI_App {
private OI_Server oiServer;
private OI_DataInstallation dataInstallation;
private OI_CommandServer oiCmdSvr;
private OI_CommandWait oiCmdWait;
private OI_AccessControlServer accessControl;
private OI_ModelFile modelFile;
private ORB orb;
private int t2Min;
private int t2Milli;
private int debugLvl;
private Socket mySocket;
private ServerSocket serverSocket;
private PrintWriter outputToSocket;
private BufferedReader inFromSocket;
public static void main(String[] args) {
try {
OI_SocketServer myApp = new OI_SocketServer(
"OI_SocketServer",
org.omg.CORBA.ORB.init(args, null),
args,
null
);
myApp.outputToListWindow("Hello I-DEAS!");
myApp.outputToSocket.println("Hello Socket!");
myApp.execute();
myApp.destroy();
}
catch (org.omg.CORBA.SystemException e) {
System.err.println(
"Detected unexpected CORBA exception,
exiting.\n" + e
);
System.exit(1);
}
catch (Exception e) {
System.err.println(
"Detected unexpected exception, exiting.\n"
+ e
);
System.exit(1);
}
System.exit(0);
}
public OI_SocketServer(String appName, ORB orb,
String[] args, String serverName) {
super(appName, orb);
this.orb = orb;
int i, portNum;
int t1Min, t1Milli;
Integer II;
String hostName;
mySocket = null;
serverSocket = null;
dataInstallation = null;
oiServer = null;
oiCmdWait = null;
oiCmdSvr = null;
debugLvl = 0;
t1Min = 5;
t1Milli = 300000;
t2Min = 10;
t2Milli = 600000;
portNum = 7878;
hostName = "localhost";
try {
// System.out.println("number of args:
"+args.length );
for (i = 0; i < args.length; i++) {
// System.out.println("arg "+i+": "+args[i]);
if (args[i].compareTo("-t1") == 0) {
II = new Integer(args[i+1]);
t1Min = II.intValue();
t1Milli = 60000 * t1Min;
i++;
}
if (args[i].compareTo("-t2") == 0) {
II = new Integer(args[i+1]);
t2Min = II.intValue();
t2Milli = 60000 * t2Min;
i++;
}
else if (args[i].compareTo("-d") == 0) {
II = new Integer(args[i+1]);
debugLvl = II.intValue();
i++;
}
// else if (args[i].compareTo("-h") == 0) {
// hostName = args[i + 1];
// i++;
// }
else if (args[i].compareTo("-p") == 0) {
Integer Int = new Integer(args[i + 1]);
portNum = Int.intValue();
i++;
}
else if ((args[i].compareTo("-?") == 0) ||
(args[i].compareTo("-h") == 0)) {
printHelp();
destroy();
System.exit(0);
}
}
oiServer = this.IIOPConnectServer(serverName);
// oiServer = this.ConnectServer ( hostName,
serverName );
if (oiServer == null) {
System.err.println(
"Unable to connect to the server,
exiting."
);
destroy();
System.exit(1);
}
oiCmdSvr = oiServer.GetCommandServer();
if (oiCmdSvr == null) {
System.err.println(oiServer.GetCurrentErrorMessage());
destroy();
System.exit(1);
}
oiCmdWait = new OI_CommandWait(m_orb, oiCmdSvr);
if (oiCmdWait == null) {
System.err.println("Memory Allocation Error");
destroy();
System.exit(1);
}
accessControl =
oiServer.GetAccessControlServer();
if (accessControl == null) {
System.err.println(oiServer.GetCurrentErrorMessage());
destroy();
System.exit(1);
}
modelFile = oiServer.GetActiveModelFile();
if (modelFile == null) {
System.err.println(oiServer.GetCurrentErrorMessage());
destroy();
System.exit(1);
}
dataInstallation =
m_oiServer.GetDataInstallation();
if (m_dataInstallation == null) {
System.err.println(oiServer.GetCurrentErrorMessage());
destroy();
System.exit(1);
}
// now initialize the socket
if (debugLvl > 1)
System.out.println("Create a new socket: Port
"+portNum+".");
serverSocket = new ServerSocket(portNum);
if (debugLvl > 2)
System.out.println("ServerSocket created...get
a Socket reference.");
// set a timeout period
if ( debugLvl > 1 )
System.out.println("Setting accept timeout to
"+t1Milli+" milli-seconds.");
serverSocket.setSoTimeout(t1Milli);
if ( debugLvl > 1 ) {
t1Milli = serverSocket.getSoTimeout();
System.out.println("Timeout returns as " +
t1Milli +
" milli-seconds.");
}
mySocket = serverSocket.accept();
if (debugLvl > 1)
System.out.println("Get a print writer on the
socket...");
outputToSocket = new
PrintWriter(mySocket.getOutputStream(), true);
if (debugLvl > 1)
System.out.println("Get a buffered reader for
the socket...");
inFromSocket = new BufferedReader(new
InputStreamReader(
mySocket.getInputStream()));
}
catch (UnknownHostException e) {
System.err.println("Don't know about host: " +
hostName + ".");
destroy();
System.exit(1);
}
catch (IOException e) {
System.err.println(
"Couldn't get IO for the connection to the
socket on port "+portNum+".\n" + e);
destroy();
System.exit(1);
}
catch (org.omg.CORBA.SystemException e) {
System.err.println(
"Detected unexpected CORBA exception,
exiting.\n" + e
);
destroy();
System.exit(1);
}
} // end OI_SocketServer(...) constructor
=====
John V. Pataki
Logged in to my Yahoo Mail account on the web.
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs