I'm just starting working with CORBA. Basically, I'm having to implement a Java application that acts as a CORBA client.
At this point, I'm mainly using the Sun JDK (JDK6) tools, including idlj.exe (to compile the IDL that I was given) and orbd.exe (for testing my code), and so far, I've been able to use the idlj and the IDL to create the Java classes, and I also wrote a test server app and test client app that are both now working (I had to write the small server app so that I could test my client app).
As I said above, I'm using orbd.exe as the ORB for my testing.
Initially, I had orbd.exe, my Java server app, and my Java client app, all running on the same machine, and that worked.
I've also tested in a more distributed configuration, where I ran orbd.exe and my Java server app on another machine (testxp), and my Java client app on a separate machine, and that works.
My question is as follows: A lot of the documents, web pages, etc. that I've seen re. CORBA have diagrams showing two ORBs, e.g., a server app and an ORB on one machine, and a client app and another/2nd ORB running on another/2nd machine, with the two ORBs communicating with each other:
client app ==> ORB1 ----> ORB2 ==> server app
whereas, in my testing so far, using orbd.exe as the ORB, I only have been using one ORB.
So, I was wondering how can I configure a test configuration where there are two ORBs as described above?
Can I do that using orbd.exe, or does orbd.exe not work in that type of configuration?
Also, if that can be done using orbd.exe, how do I do that?
Thanks,
Jim
CORBA is an architecture and infrastructure to communicate application in a network. And ORB is the component that serialize (marshal) and deserialize (unmarshal) the calls to IIOP. With CORBA, you can write a code in C# (using IIOP.NET) and communicate with a server in Java.
So, you are right, the communication is made between ORBs.
|client app| <==> ORB1 <--(IIOP)--> ORB2 <==> |server app|
ORBD is an ORB with a Naming Server. It is ideal that you have only one Name Service, you can read about name service here.
Finally, you have many ways to start comunication between ORBs. (a) activate servant in the POA and call method *poa.object_to_string(servant)*, write the string in a file then read it in the client using *poa.string_to_object(fileAsString)*. (b) define server host and port and use corbaloc. (c) subscribe in a name server (best option).
Try to use three process in your test. Name Server, Client, Server.
PS: I like JacORB then JDK Orb
EDIT:
Adding some code to help:
orb = org.omg.CORBA.ORB.init(args, props);
org.omg.CORBA.Object obj = this.orb.resolve_initial_references("RootPOA");
this.rootPOA = POAHelper.narrow(obj);
POAManager manager = this.rootPOA.the_POAManager();
manager.activate();
Related
I am looking for an approach to create a java application for web socket. This application should not use any server's jars.
I say this because I have seen that java client for web sockets are available only for server to server communication. If I need to create it outside the server I have no other go to get those server's jars imported inside.
nv-websocket-client is a new WebSocket client library written in Java. It requires just Java SE 1.5, so it can run even on Android. The size of nv-websocket-client-1.3.jar (released on 2015-05-06) is 62,854 bytes and it does not require any external dependencies. See "WebSocket client library (Java SE 1.5+, Android)" for details.
I'm not sure I understand your question completely but from what I can gather of your question you might want to look into just plain old sockets. It uses a simple tcp protocol to talk between Java applications and is supported natively in Java take a look at this example (http://cs.lmu.edu/~ray/notes/javanetexamples/). Another alternative for server to server communication is to use something like RabbitMQ (http://www.rabbitmq.com/) or Kafka (http://kafka.apache.org/) but those require much more setup and are more complex then sockets.
You are asking for java, however I suggest you cast your net wider and dive into using Node.js (javascript) as your web socket client/server ... nodejs applications run outside the browser and offer super fast asynchronous networking using the V8 c++ javascript engine ... the same engine which lives at the heart of google's chrome browser ... think of it as the JVM for javascript ... you write javascript yet it executes at c++ speeds
To build a socket application you need only a server part where you instantiate a java.net.ServerSocket and a client part where you instantiate a java.net.Socket.
To do that is not necessary any special library.
Those are standard java applications (with a public static void main(String[] args) method) so you don't need a server environment (servlet container or Java EE container).
I am having difficulties understanding the difference between network mode and non-network mode terms as used when dealing with client server applications in java.
I know how to develop simple client server apps. For example I can create a client application and server application. These applications can connect to through sockets and send and receive data. I however get confused when people talk about running a server and client in standalone mode, where both the client and server use the same instance of a JVM without loop back networking involved. I have seen this happening with the java derby database.
So my main question is how do you take code that was using sockets to communicate and convert it to use the so called "standalone mode" where the client and server run as one application? I will appreciate any comments that point me to the right material.
In the so-called network mode you have to connect to a remote server, as you describe, typically through a socket and so your client asks the server to do certain task, the server carries out the task and responds to the client.
In this mode, it is customary that the client and the server will be different nodes, that is different machines, running independently.
But what if you wanted to run you client and your server in the same machine? Even in the same virtual machine? Would it make sense to go through a socket to ask your server to do something?
That would be like using Skype to chat with a friend sat right by your side, to simply ask him to go have lunch.
So, ideally, in these cases, you should be able to run your application in non-network mode. That is, instead of going through a socket, you access your sever object directly and ask it to do something for you. Since your server object is located in the same virtual machine as your client.
Evidently, for you to be able to do this, you need a good design that exposes your server functionality through an interface, and your application uses this interface to interact with the server. When you are running in network mode, you use an implementation of this server interface that uses a socket (or RMI or whatever you do for network communication). When you are in non-network mode, you get an implementation of the server object itself.
I have a code running in router that sends UDP packets(using Sendto() function and a string of data) to a particular server whose IP address and port number I will mention in my code.
I want to deploy a server application that could receive a UDP packet and store its information on server or somewhere else not sure right now.
I have decided to use Google app Engine for hosting my server side code which most probably will be having something like recvfrom() function to receive string.
So how and by using what API's can I start developing my server side code.
Google App Engine has a Preview release of a Socket API, but it does not let you create listening sockets. See Limitations and restrictions section at https://developers.google.com/appengine/docs/python/sockets/
You cannot create a listen socket; you can only create outbound sockets.
You can use Google Compute Engine to run any reasonable software on Google's cloud platform, including programs that receive UDP datagrams. You must always pay for Compute Engine instances.
According to the newest edition of App Engine Socket docs for Java, if you're using java 8 runtime you should be able to use java sockets without limitations:
Applications in the Java 8 runtime default to using native Java
sockets with no restrictions: Google recommends that you keep this
default.
That means that it should be possible to use java.net.DatagramSocket or java.nio.channels.DatagramChannel freely to work with UDP.
i am developing an android application in which the server side execution is done using a simple java udp program.i want to know how i can host this application because i need a static ip server to run the java program.can i run my java program in a server.is it possible if yes how?
You'll have to write a listener in some language (PHP, Java, Etc.). As for a static ip address, you can also look at a dynamic ip redirection service like no-ip;
http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html
You can use a personal machine thats always online, or you can try to use a shared hosting plan that allows you to have a listening port open. A web service will likely be easier to work with than having some custom UDP/TCP connection.
I have connected to a socks5 server in my java application, and now I want to launch an external application and have all of its connections run through the socks5 server. The external application itself doesn't support socks5.
Any input would be great, scratching my head here..
The 2 trick I know how to do that are to replace the standard runtime library or a similar trick to intercept the OS networking calls or to setup a set of finely tuned firewall rules in the kernel.
Both of these techniques are very OS specific and have no way to da that using java.
Your best bet would be to run an existing socks5 wrapper and let that program start the external application like socksify.
I have had mixed experience with this approach, some applications work, others do not, and never found any logic in it.
YMMV
Another approach is to play a tcpproxy in the Java application (e.g. using the Apache MINA stuff) and have the application connect to your proxy port on localhost. Again this will only work for certain services.
If the external application is written in Java it does support SOCKS. Just run it with -DsocksProxyHost=host and -DsocksProxyPort=port. See [1].
[1]: http://download.oracle.com/javase/6/docs/technotes/guides/net/properties.html "Networking Properties".