First Mico CORBA Demo transcript

Source: Internet
Author: User

Because busy with other things not carefully to learn the CORBA principle, it is probably based on the online tutorial set up a use of MICO demo

The records are as follows.

Here, the code I will not post, the program is not explained in detail, because the project folder has a PPT in detail to explain the meaning of this program, I put the key points, such as network environment configuration, program structure,Makefile MICO , compile and install the

Click here to download the project folder

Compiling and installing MICO See this essay

1. Environment

  Virtual Box + Ubuntu 12.04 LTS , used to build Server program

  GNU GCC, note that Ubuntu is not with GNU GCC by default, see this essay

  Windows 7 , used to build Client program

  Microsoft Visual Studio 2013

network environment: Because there is no router on hand, but there is a usb wireless card, so a is established with the mobile phone. wifi hotspot usb wireless adapter assigned to vbox ubuntu system use, and then windows and ubuntu all connected to the phone established by the wifi hotspot 2 A network card can be with each other. ping pass.

The reason for configuring the network environment: First, I don't have a router on hand, no2computer (of course, written as a mobile app can be, but the time is not the intention of this), so only use virtual machine. Second, with a virtual machine, if you do not make some configuration, you can onlyPINGHost , but not from the hostPINGVirtual Machine , this is because the VM network configuration is generally usedNAT, you inUbuntuused inifconfigYou can view the Eth0 (Ethernet port0, I use the internet cable) of theinet addr (i.e.IPv4 Addr) is similar to10.0.2.15Such an address, while the host of the inet addr (inWindowsunder the nameIPv4 addr, withipconfigOrarp-acan be viewed) is similar to 113.54.xxx.xxx (depending on your region and network operator), so if you do not configure to solve this problem, from the host isPINGVirtual machines , virtual machines can rely onNATcome toPINGthe host, but not the reverse. Of course, the method of configuration, there are a lot of online, for exampleThis article, although I am very interested, but I recently limited time to do so many experiments, you can try. So I'm going to use what I can get. This is a network environment.

How can we test it?PINGThe above network environment is built,Windowsunder, enteripconfigCheck out yourWIFI Hotspotin theIPaddress, for example, I get the result isWireless LAN Adapter wireless network connection IPV4 Address:192.168.43.2 ; then toUbuntuconnected to the phone set upWIFI Hotspot, enterifconfigYou can see, like mine.wlan0 inet addr:192.168.43.167。 So now it's possible toWindowsunderPING 192.168.43.167or inUbuntuinPING 192.168.43.2, nothing unexpected is possible.PINGthe.

2. Procedure

First, the network port

Search for 192.168.43.167:9001 in server.cpp , as you can see, this is the port that the server listens to, so Open Client.cpp, you can see that the client is also connected to this port

Then, the makefile and the program structure

Makefile inside or wrote a lot of comments, should be explained more clearly

For the client side, I only provided makefile.win32, that is, to visual Studio NMAKE, for the server side, I have provided both MAKEFILE.WIN32 and makefile to GNU make use

Under Windows, I did not choose to Mico all the executable files (Idl.exe those) into the environment variables, but directly copied to the project folder Mico-bin-win32, so when writing Makefile.win32, is to use the relative path to invoke IDL these Mico executable files

In Ubuntu, I also take this strategy (actually completely unnecessary, because if you just use the default ./configure, then make and install will be installed to / Usr/local directory,IDL and other programs are in the environment variables, but also do not have to do so, but also too lazy to change, and then do other things when the attention is that the relevant code is $ (CD) src; $ (IDL) Account.idl, as for why these two commands to write to a line separated by semicolons, see This article (and search cd/home/hchen; pwd)

In addition, for the server side, when compiling under Ubuntu, there are 2 options in makefile-lpthread and-lssl, that is to say Mico relies on these two libraries (don't ask me how to find, a bunch of undefined Reference again Google a bit to know), POSIX thread Library in Ubuntu is the default comes with, but SSL library is not, need to install, see this essay

  

3. Compile and run

In Ubuntu, you can compile the server by typing make, and the executable file is bin/micoserver. Under Windows, open the VS2013 developer command prompt, switch to the client's directory, enter nmake/f makefile.win32 to compile the client, and the executable file as bin\ Micoclient.exe (server can also be compiled under Windows, just like the method of compiling the client)

  

According to the previous network configuration, we know that the IP address on this side of the server is 192.168.43.167,client IP address is 192.168.43.2

First in Ubuntu, run nsd-orbiiopaddr inet:192.168.43.167:9001, note that if you don't install Mico to/usr/local, Then you'll have to find NSD's relative path to execute the NSD program.

Then open another command-line window and run the compiled Bin/micoserver

Go back to Windows and run Micoclient.exe

Run as follows

_______________________________________________________

My problem is that if you put the server in a virtual machine, the client is placed in the host, the client always accesses the virtual machine, and then hangs up. But the reverse is possible (of course, both the client and the server are in a machine, needless to say, and certainly can be run). Have the opportunity to find two machines to try.

  

First Mico CORBA Demo transcript

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.