NAT support - how to obtain the public IP address?

Hi
I am developing an instant messenger in which users can start a conversation with another user through obtaining the IP address of the intended recipient from a mySQL database on the web server.
This works fine within a local network. However, the address in the database upon user login is the private IP address within the LAN and not the global address - consequently my software cannot be used outside the LAN currently.
Is it possible to use a method within the java.net library to send the public (global) address of the client to a server? And if so, how can I handle the ability to receive a reply from the server (which would arrive at the public IP the message was sent from, ie. the NAT firewall) so that it is delivered to the correct port and private IP on the client?
Joe Barber

If the server is on the public internet and the client is on a private network the server will see the public address and port, and can get it from a connected socket. Unfortunately if the nat box uses DHCP there is no guarantee that this will be the same next time, so persisting that value in a database is not a good idea. If both the client and server are behind nat gateways, they cannot directly establish calls. The better choice for these kind of systems is to run the server on the public internet on a well known address and have your clients connect to the server.
You will find lots of discussion on the difficulties of nat and p2p on this forum and by looking in google.

Similar Messages

  • How to obtain the row data in the component datatable?

    if I want to edit a row data, and then know which row is edited in the component datatable, and how to do?
    How to obtain the row data in the component datatable, and update it to database, not simplely edit a simple table
    Any ideas? Thanks

    Thank you very much for your help Alexander !
    It's quite confusing when you leave Struts and try to adapt your projects for JSF for the first time...
    I wanted to click on a row with a "onMouseClick" on the TR tag like I used to do in Struts/JSTL. But it seems to be impossible in a dataTable.
    Ok then. I've added a column at the end of the row with an icon.
    But eventually I didn't need to declare link parameters.
    In my BackingBean I did like this :
    public String selectEventForUpdate() throws IllegalAccessException, InvocationTargetException {
            PortletAgenda event = (PortletAgenda) JSFUtils.getInRequestMap("event");
            BeanUtils.copyProperties(this, event);
            return null;
       }JSFUtils.getInRequestMap(...) is a method I wrote in a util object :
    public static Object getInRequestMap(String name) {
            Object res = null;
            Map requestMap=FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
            if (requestMap!=null) {
                res=requestMap.get(name);
            return res;
    }  " event " is the name of the item in my dataTable list.
    My backingBean has the same attributes as "event".
    So when the page is reloaded I have a backingBean full with the selected properties to edit/update.
    Thanks to your reply I realized that putting this form in the middle of the dataTable seems to be impossible.
    So I put this form in a floating DIV in front of the table with a shadow.
    It works :o) !
    But I'm a little bit disapointed to be honest...
    I used to build my web applications with Struts and JSTL and doing this kind of interface was really easy.
    I've decided 3 days ago to convert into JSF because the "GUI Layer" seemed to be improved.
    But now I realize that I cannot put a onMouseOver and onMouseClick on a row and I cannot display a different row in the middle of a table....
    I think it's a shame because there is a facet for header and footer.
    And it would be great if we could create our own personal facet that appears only if a condition is true.
    For exemple " if the current item id is the same as the request parameter id then display the following facet content ....... (with a panel group and a form inside to update the row) "
    It's easy to do that with JSTL thanks to c:forEach and c:if but it seems to be impossible to use JSTL tags like this during the dataTable iteration.
    And JSF tags seems to have no logical tags like " if " or loops that can be nested in dataTable.
    I really need to realize this interface (you click on a row then an edit form appears where you clicked).
    Do I have to write a component myself that extends dataTable?
    Do you know if writing such a component is hard to do for a beginner like me?
    (I've juste discovered JSF 3 days ago and I've used Struts/JSTL for 2 years til now)
    I'd be glad to have much advices from you about that.
    Regards

  • How to obtain the running time of a task?

    How to obtain the running time of a task? I want to write a program about task progress.
    My email: [email protected]
    Thanks!

    First, Thanks for your code.
    But, I want obtain running time before running it.
    Example:
    class a extends JFrame{
    a() {
    initComponent() ;
    new progressBar(this); // my fancy. (may be other type variant.)
    void initComponent() {
    class progressBar {
    JProgressBar proBar = null ;
    Timer taskTime = null ;
    Double longTime = null ;
    progressBar(JFrame frame) { //JFrame or other.
    longTime = // ??????? You know ?????
    void monitor() {
    taskTime = new Timer(1000, new ActionListener() {
    public void actionPerformed(ActionEvent event) {
    //repaint the proBar code.
    taskTime.start();
    }

  • How to obtain the license for the mentioned products.

    Hi All,
    Please help me in below licensing issues.
    1) Our functional team got the below error while accessing "Job Scheduling Workbench".
    Error: The Workbench is inaccessible because Oracle Manufacturing Scheduling has not been licensed. Please work with your Account Manger to purchase the license.
    2) Another error message while accessing the navigation Flow Manufacturing --> Product Sync --> Flow Routings
    Error: APP-BOM 20972: You cannot access this form
    Cause: You do not have a license for Oracle Flow Manufacturing.
    Action: Obtain a license for Oracle Flow Manufacturing.
    Please guide me how to obtain the license for the above products.
    Environment: eBS R12.1.3 on Linux 5.8
    Regards,
    Siva

    Thanks for providing the document. I follow the document and get back to you for any issues.
    Regards,
    Siva.

  • How to obtain the updated column name in a trigger?

    Hello everyone,
    I need to know for audit propose the updated column name in a After Update Trigger on a Table.
    The table have more than 20 columns, and i think that do more than 20 conditions asking for the difference between the :new value and the :old value is not the best way.
    Thanks for the help!
    LCJ

    Hi,
    Thanks to all for the replays.
    I didn't know that i can pass the column name to the UPDATING. This is only possible on 10g??
    Any way, i pass the column name and works fine, but i have another issue because of that.
    I obtain the column name from a cursor that query user_tab_columns view, when i try to obtain the value of the :old or :new, i can't because i don't know how to obtain the value of the value.
    This example show better:
    DECLARE
    vOldValue Varchar2(50);
    Cursor cur_Column_Names Is
    Select COLUMN_NAME
    From User_Tab_Columns
    Where TABLE_NAME = 'table_name';
    BEGIN
    For var_cursor In cur_Column_Names Loop
    If Updating(var_cursor.COLUMN_NAME) Then
    vOldValue := '?'; -- How obtain the value of the :old. + >var_cursor.COLUMN_NAME??
    End If;
    End Loop;
    END;Thanks to all for the help.
    LCJ

  • A very simple question: how to obtain the mail server name?

    In our JSP application, at one point an email will be sent to notify one event. Currently, that is done by using the html tag: mailto. To have more control on the email in tems of context format (a bad layout right now) and others. I would like to have it processed at servlet by using the JavaMail API, so that it have a nice format and have the sender's email address right in case email client is not installed in the machine where the browser in. The JavaMail API is straight forward. The question is how to obtain the mail server name, and the sender's email address if there is one?
    Thanks.
    v.

    How to obtain the mail server's name? It's your server, you should know its name. Or if it isn't your server, you should ask the administrator for its name. Point is, you need to decide in advance what server you are going to use and hard-code its name into the program or into a properties file.
    And how to obtain the client's e-mail address? You have to ask the client, probably by putting a box in the HTML and asking them to type it.

  • How do obtain the number words typed in a Pages document?

    How do obtain the number words typed in a Pages document?

    I found it!  To get the number of words in my Pages 5.1 document...I clicked on the paper-icon on the far left...(at the very left edge) it gave me a selection that ended with "count words."  TaDa!  Thanks

  • How to obtain the alv reports in the dilog programing.

    how to obtain the alv reports in the dialog programming, that is when the push button in the screen in clicked it must be directed to the report, where to write the code for the report.

    Hi
    Use LEAVE TO LIST PROCESSING and develop your normal ALV dispaly as usual. System automatically takes care of this.
    I tried for normal report but try above even in the case of ALV reports
    Cheerz
    Ram

  • I need to reinstall CS5 on a machine that has had to be reformatted, i need a Support Code after obtaining the Challenge Code. Please help

    I need to reinstall CS5 on a machine that has had to be reformatted, i need a Support Code after obtaining the Challenge Code. My email address is <removed - kglad>
    Please help

    <moved from Adobe Creative Cloud to Downloading, Installing, Setting Up>
    use your serial number to activate.  if you cannot connect to adobe's server's to activate, Sign in, activation, or connection errors | CS5.5 and later

  • How to obtain the manage beans instance to oprate it in javacode

    in the faces,there is some manage bean, but i what to operate it ,eg: carbean.carName = "xxxx"; carbean is a managed bean:
    How to obtain the manage beans instance to oprate it in javacode

             ActivityContentBean activityContentBean = (ActivityContentBean) FacesContext
                        .getCurrentInstance().getApplication().createValueBinding(
                                  "#{currentActivity}").getValue(
                                  FacesContext.getCurrentInstance());

  • How can change the Public IP in SAP

    Hi,
    How can I change New Public IP address  in PRD/DEV server for remote access.
    Thanks in Advance
    Rgds
    Tapovardhan Singh

    Hmm...
    This is a long wait for a reply...
    I wonder, have I asked a dumb question?
    or, have I asked a question that no-one knows the answer?
    I have had to go ahead and try the change... I changed the public Ip
    address and now I have broken Groupwise and eDirectory.
    I cannot login as Admin, I get a -626 error of object not found.
    I have tried re-running the Yast wizards for eDirectory and Groupwise,
    there were changes that could be made in the Groupwise configuration
    screens. I found a Tid that described running grep to find all instances
    of the old ip address in /etc. This I ran and found 3 instances, however 2
    of the files could not be changed and the third SYSCONFIG, when changed it
    reverted back on reboot... maybe this files is a status file?
    Anyone able to help me here?

  • How to obtain the default serie for a document

    Hi,
        Anybody know how can obtain the default serie for a document throw a query??
    I can`t see the relation between the ONNM and the NNM1 tables because the 'dfltseries' field of the ONNM not corresponding with the 'Series' field of the NNM1.
    For example for an A/P Invoice
    Thanks!!

    Hi Mariano,
    According to the SDK Help file, you need to query the NNM2 table
    Series Default
    Table name: NNM2
    ObjectCode     UserSign     Series     DocSubType
    So, the query to retrieve the A/P default series for the manager user would be:
    SELECT T0.Series FROM [dbo].[nnm2] T0 WHERE T0.ObjectCode='13' AND T0.UserSign = 1
    From the SDK you can replace the T0.UserSign = 1 for T0.UserSign = oCompany.UserSignature to retrieve the default series for the current user...
    Regards,
    Vítor Vieira

  • Valuations default profit center, how to obtain the original profit center?

    Hi Experts,
    Currently our valuations are being booked; they book the BS Account vs Unrealized Exchange Gain or Loss.
    The Profit Center for that BS Account is being determined automatically by the 3KEH table. Is there any way to derive the profit center from the Original Line Item?
    Example Entry
    PK     Account     Amount     Profit Ctr     
    40     10403494     549.21     OO6376DDD      BS Account - How to obtain the profit center from the original postin?
    50     37300104     549.21-     OO6376AAA  Exch Gain/Loss
    Thanks.

    Hi.
    '2. I know its going to be reversed the next month, our concern is that the amount that is going to the default profit center then will be allocated via cycle based on SKF so reflecting the data in profit centers that are not the ones that were originally affected.'-actually you can exclude adjustment account from sender while allocating,but it's better to substitute with right PC.
    '3. any logic on how substitution might work?' in fibf you can use process 1120
    'will it bring performance issues?'-no
    '1. How can this be worked via Doc Split for Unrealized? Do you have any example.'-it's not clear a question
    Edited by: alex ice on Apr 14, 2011 11:12 PM

  • Formatting Tips, how can obtain the right  format?

    how can obtain the right format of code,
    http://forum.java.sun.com/help.jspa?sec=formatting
    if is possible do a example.
    Thanks in advantage

    Wrap your code between [code] and [/code]
    [code]
    // Here goes my code
    [/code]
    looks like
    // Here goes my code.

  • How to change the public display name?

    How to change the public display name since the last person left the job and I am not new person take it.

    Hello,
    The TechNet Wiki Forum is a place for the TechNet Wiki Community to engage, question, organize, debate, help, influence and foster the TechNet Wiki content, platform and Community.
    Please note that this forum exists to discuss TechNet Wiki as a technology/application.
    As it's off-topic here, I am moving the question to the
    MSDN and TechNet Profile and Recognition System forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

Maybe you are looking for

  • How can I print a free format style report that is 3 pages long

    You may say this would be like a letter format (no columns), but is actually a formatted document. It is on 3 pages. I was instructed by a Oracle reports teacher to place on multiple frames with page protect to fix my problem of text for one line of

  • Itunes not recognising ipod classic

    Hi all, if your using a Black iPod classic 160GB with wheel on the front when using and connecting to iTunes, if iTunes does not recognise your iPod you will need to  reload iTunes from Apple site, don't let any one tell you it is possible to uninsta

  • Power supply retailers near Philadelphia? G5 won't turn on anymore.

    When I went to bed last night, my Mac was on and running fine. This morning, it was off, and would not turn back on. When I press the power button, absolutely nothing happens. I plan to replace the battery first, as I have seen recommended. If that d

  • ITunes suddenly won't launch

    I suddenly can't launch iTunes. I have followed Apple's iTunes uninstall procedure to the letter, restarted my computer and downloaded and reinstalled iTunes, the latest version. It won't even open. It crashed while I was updating my iPod Touch. I re

  • Dividing Jobs in Distributed Systems

    Can anyone offer a scheme that will allow me to distribute jobs to clients dynamically? Let's say I want to check whether a number is a Prime number or not using this algo: n = {a large prime number}; for (i = 2 to n/2 ) if (n mod i == 0) return "com