Java socket run on localhost against outside server

Hi everyone,
I am newbie to Java socket and networking. By spending this weekend over the internet reading and researching I have made my first Server-Client java socket program run sucessfully on my localhost 127.0.0.1. They can be connected and ok to communicate.
However, when I put my server program to the LIVE server outside the network the client side says cannot connect to the server because: Connection Error, Connection refused: connect. So I read some stuff about firewall and NAT on the web but i was shamed that I don't understand there is any solution to this.
It is great appreciated if someone can point me out how can I resolve this or make a step out because I am running out of time to give out the program against the deadline. But I really thank you anyone has been reading this.
The server code:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package instantmessenger;
import java.io.*;
import java.net.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
    public class Server extends JFrame implements ActionListener {
        JTextArea textreceive   =new JTextArea();
        JTextArea textsend      =new JTextArea();
        JButton button          =new JButton("Send");
        BufferedReader in;
        PrintWriter out;
        public Server () {
                //init   controls
                setTitle("Server");
                setBounds(50,50,500,400);
                getContentPane().setLayout(null);
                getContentPane().add(textreceive);
                getContentPane().add(textsend);
                getContentPane().add(button);
                textreceive.setBounds(10,10,450,300);
                textsend.setBounds(10,320,350,30);
                button.setBounds(370,320,70,30);
                button.addActionListener(this);
        public void listenClient() throws IOException {
                ServerSocket   server=new   ServerSocket(9999);
                System.out.println("start:"+server);
                textreceive.append("start"+server+"\n");
                try {
                        Socket s = server.accept();
                        try {
                                System.out.println("connecting   :"+s);
                                textreceive.append("connecting   :"+s+"\n");
                                in = new BufferedReader(new InputStreamReader(s.getInputStream()));
                                    out=new   PrintWriter(
                                    new   BufferedWriter(
                                    new   OutputStreamWriter(s.getOutputStream())));
                                out = new PrintWriter(s.getOutputStream());
                                String str=null;
                                while(true) {
                                        str = in.readLine();
                                        System.out.println(str);
                                        textreceive.append(str+"\n");
                        finally {
                            s.close();
                finally {
                    server.close();
        } // end function
        public void actionPerformed(ActionEvent event) {
                String str = textsend.getText();
                if( !str.equals("")) {
                        out.println(textsend.getText());
                        //out.println(textsend.getText());
                        out.flush();
                        textreceive.append(textsend.getText()+"\n");
                        textsend.setText("");
        } // end function
        public   static   void   main(String   args[])   throws   IOException {
            Server   s=new   Server();
            s.show();
            s.listenClient();
        } // end function
    } // end classThe client source code:
package instantmessenger;
    import   java.net.*;
    import   java.io.*;
    import   javax.swing.*;
    import   java.awt.*;
    import   java.awt.event.*;
    public   class   Client   extends   JFrame implements   ActionListener {
        JTextArea   textreceive=new   JTextArea();
        JTextArea   textsend   =new   JTextArea();
        JButton     button   =new   JButton   ("Send");
        BufferedReader  in;
        PrintWriter     out;
        public Client(){
                //init   controls
                setTitle("Client");
                setBounds(50,50,500,400);
                getContentPane().setLayout(null);
                getContentPane().add(textreceive);
                getContentPane().add(textsend);
                getContentPane().add(button);
                button.addActionListener(this);
                textreceive.setBounds(10,10,450,300);
                textsend.setBounds(10,320,350,30);
                button.setBounds(370,320,70,30);
       } // init
        public void startNet() throws IOException {
              //Socket client=new Socket("localhost",9999);
              Socket client=new Socket("222.33.444.5555",9999);  // NOT REAL SERVER IP
              try {
                      System.out.println("Socket="   +client);
                      in    =   new BufferedReader(new InputStreamReader(client.getInputStream()));
                      out   =   new PrintWriter(new BufferedWriter(new OutputStreamWriter(client.getOutputStream())),true);
                      String str=null;
                      while(true) {
                          str   =   in.readLine();
                          System.out.println(str);
                          textreceive.append(str+"\n");
              finally {
                    client.close();
        } // end function
        public void actionPerformed(ActionEvent   event) {
            String str=textsend.getText();
            if(!str.equals("")) {
                out.println(textsend.getText());
                //out.println(textsend.getText());
                out.flush();
                textreceive.append(textsend.getText()+"\n");
                textsend.setText("");
        } // function
        public static void main(String args[]) throws IOException {
            Client c=new Client();
            c.show();
            c.startNet();
        } // function
} // end classThank you
Morris Lee

However, when I put my server program to the LIVE server outside the network the client side says cannot connect to the server because: Connection Error, Connection refused: connect. So I read some stuff about firewall and NAT on the web but i was shamed that I don't understand there is any solution to this.What do you want us to do? You already know that the problem probably is that you need to open port 9999 in the firewall, and you probably also need to configure it for port forwarding.
Most clients will be able to connect after that, but some might still have problems. E.g. some companies don't allow clients to connect to other ports than a few well known ones (e.g. 21, 80 and 443)

Similar Messages

  • How do I determine in Java if running local or deployed weblogic server

    Using JDeveloper 11.1.1.4.0
    I need to determine in my Java code, if I am running my application locally (JDeveloper/Weblogic) or if the application is running on a deployed Weblogic server. The code will be used to determine where to place files when testing on PC verses where to place files when deployed. For example (c:\temp or /usr2/upload).
    Thanks,
    Troy

    Hi,
    well one way is to identify using weblogic system properties here is the one example to get weblogic managed server name of application running in java http://www.baigzeeshan.com/2011/11/oracle-adf-how-to-get-managed-server.html
    check other properties as well http://docs.oracle.com/cd/E13222_01/wls/docs90/config_scripting/config_WLS.html#1019588
    Zeeshan

  • Configuring Forms Builder 10g to run (Ctrl-R) against application server

    I would like to run forms from my working directory against our development application server and config, rather than having a local OC4J running. I have configured this by setting the application server URL runtime preference to "http://<server>.<domain>:80/forms/frmservlet?config=dev". This works fine.
    However, when I run the Form, I get "FRM-40010: Cannot read form H:\Neil\TAF00180.fmx". This is because we open our FMBs from a locally mapped drive (i.e. I opened the FMB from H:\Neil\TAF00180.fmb). When run against the application server it seems Forms Builder trys to run an executable with the same path as the FMB - H:\Neil\TAF00180.fmx, but the application server has no knowledge of a mapped H-drive.
    The only solution I can think of is to have an H-drive mapped on the application server to the same location as our locally mapped network drive.
    This doesn't seem like the correct solution to me. How should we configure Oracle Forms 10g and the application server to allow us to run our own working versions against the applications server and config?

    Slava Natapov wrote:
    I guess Neil concern is that OC4J and Forms Server are using own formsweb.cfg and .env files
    And settings can be different.
    For example what if local formsweb.cfg configured to run Jinitiator, but server formsweb.cfg configured for JPI, or they configured with different lookandfeel parameter, or local and server default.env use different NLS_DATE_FORMAT?Hi Slava, Hi Neil
    I think this is more related to "discipline" for the developers....
    @ Neil : How many developers do you have in your team ?
    Are developers allowed to "customize" their formsweb.cfg and .env files ?
    or more customized basejinit.htm, registry.dat, additional jar files ... etc
    or more using different oracle_home for their installation of Developer Suite.
    @ Slava : Using local formsweb.cfg and .env files might not be a problem if every developer machine is installed the same way (i.e. the same oracle_home).
    Also, I don't think that using workingDirectory to network shared connection for each developer is a solution
    [dev1]
    workingDirectory= H:/dev1
    [dev2]
    workingDirectory= H:/dev2
    And at least this is requiring customized *.env files ! as the forms_path should be set for runtime in it for each developer.
    The registry entry is only for the builder to find the path to mmb and pll files for example, and compile well, but the runtime is using *.env files.
    And what about developing in windows and deploy it to linux ?
    I recently managed a project with junior and undisciplined developers. The boss had the same concern about each network drive per developer.
    My concern was how to eliminate all subjective considerations..
    And my answer was "Subversion" no mess with local or network version with the "copy of the copy of the copy of the fmb files".
    So all forms_path were set to C:\myApp\forms etc and each developer made a checkout and commit versions twice a day.
    And the Application Server was also "checked out" to have the latest revision and then ran it into a pre-version for production.
    If I had to make some important changes in the *.olb file or the *.pll files then I made a commit for all developers and then re-compile all *.fmb and re-commit and checkout again.
    I really don't matter if the developer used jinitiator or jpi but the right working copy.
    And standalone OC4J was enough to make basics tests for each developer.
    More tests were made by project managers at the application server level and then adjustments (if required) where sent to developers.
    Hope this helps.
    Regards,
    Jean-Yves

  • Need help in using [RUN PROGRAM] Activity against a server in another domain

    Hi Experts,
    We have two domains with two way trust enabled. Orch server exists in DomainA and target server exists in DomainB.
    We are trying to execute some scripts(g:IPCONFIG) from orch server to target server using RUN PROGRAM activity. This is  running fine and give expected results, if I give Built-in Administrator credentials in Security Tab. But I'm getting some
    strange values like chinese/japanese language strings, If I use a DomainB/DomainA user (Part of local admin of the target server) in security tab as well as Advanced tab-->Runas.
    Things I tried:
    - DomainA/DomainB user in Security Tab as well as RunAs tab  ---> Strange Strings
    - DomainA/DomainB user in Security Tab and BuiltIn Administrator in RunAs tab  ---> Strange Strings
    - BuiltIn Administrator in Security Tab ---> Expected result
    - BuiltIn Administrator in Security Tab and DomainA/DomainB user in RunAs tab  --> ProgramExitCode = -10xxxxxx
    But our requirement is to run the script on the target server as Domain User(Part of local admin).
    Thanks in Advance
    Thanks and Regards, Narayana Babu

    Hi Experts,
    We have two domains with two way trust enabled. Orch server exists in DomainA and target server exists in DomainB.
    We are trying to execute some scripts(g:IPCONFIG) from orch server to target server using RUN PROGRAM activity. This is  running fine and give expected results, if I give Built-in Administrator credentials in Security Tab. But I'm getting some
    strange values like chinese/japanese language strings, If I use a DomainB/DomainA user (Part of local admin of the target server) in security tab as well as Advanced tab-->Runas.
    Things I tried:
    - DomainA/DomainB user in Security Tab as well as RunAs tab  ---> Strange Strings
    - DomainA/DomainB user in Security Tab and BuiltIn Administrator in RunAs tab  ---> Strange Strings
    - BuiltIn Administrator in Security Tab ---> Expected result
    - BuiltIn Administrator in Security Tab and DomainA/DomainB user in RunAs tab  --> ProgramExitCode = -10xxxxxx
    But our requirement is to run the script on the target server as Domain User(Part of local admin).
    Thanks in Advance
    Thanks and Regards, Narayana Babu

  • Java Dispatcher running but no server connected

    Hi,
    We are facing problem in Starting the Java
    The Server process is teminating with following error
    We found the following error in std_server0.out file.
    stdout/stderr redirect
    node name : server0
    pid : 98216
    system name : BWD
    system nr. : 00
    started at : Mon Nov 19 16:54:27 2007
    [Thr 01] Mon Nov 19 16:54:28 2007
    [Thr 01] MtxInit: -2 0 0
    <?xml version="1.0" ?>
    <verbosegc version="20060331_AA">
    SAP J2EE Engine Version 7.00 PatchLevel 108458.44 is starting...
    Loading: LogManager ... 4610 ms.
    Loading: PoolManager ... 3 ms.
    Loading: ApplicationThreadManager ... 990 ms.
    Loading: ThreadManager ... 195 ms.
    Loading: IpVerificationManager ... 33 ms.
    Loading: ClassLoaderManager ... 121 ms.
    Loading: ClusterManager ... 1019 ms.
    Loading: LockingManager ... 125 ms.
    Loading: ConfigurationManager ... </verbosegc>
    trc file: "dev_ms", trc level: 1, release: "700"
    [Thr 01] Wed Nov 21 17:40:28 2007
    [Thr 01] WLM Tag 'BWD/MSG' successfully set for this process
    [Thr 01] Wed Nov 21 17:40:29 2007
    [Thr 01] MsSSetTrcLog: trc logging active, max size = 20971520 bytes
    systemid 324 (IBM RS/6000 with AIX)
    relno 7000
    patchlevel 0
    patchno 110
    intno 20050900
    make: multithreaded, ASCII, 64 bit, optimized
    pid 28736
    [Thr 01] ***LOG Q01=> MsSInit, MSStart (Msg Server 1 28736)
    [msxxserv_mt. 1824]
    [Thr 01] SigISetDefaultAction : default handling for signal 20
    [Thr 01] Wed Nov 21 17:40:30 2007
    [Thr 01] MsInitAclInfo: acl file /usr/sap/BWD/SYS/global/ms_acl_info
    not found, unrestricted access
    [Thr 01] MsGetOwnIpAddr: my host addresses are :
    [Thr 01] 1 : [192.168.50.13] uplbwd (HOSTNAME)
    [Thr 01] 2 : [127.0.0.1] loopback (LOCALHOST)
    [Thr 01] MsHttpInit: full qualified hostname =
    aplaium050h.agr.chem.corp.local
    [Thr 01] HTTP logging is switch off
    [Thr 01] *** WARNING *** obsolete parameter ms/http_port - use
    ms/server_port_0 = PROT=HTTP, PORT=8100
    [Thr 01] ***LOG Q0I=> NiIBindSocket: bind (67: Address already in use)
    [nixxi.cpp 3174]
    [Thr 01] *** ERROR => NiIBindSocket: SiBind failed for hdl 2 / sock 10
    (SI_EPORT_INUSE/67; I4; ST; 0.0.0.0:8100) [nixxi.cpp 3174]
    [Thr 01] *** ERROR => MsHttpCommInit: Ni2Listen(8100) (rc=NIESERV_USED)
    [msxxhttp_mt. 3444]
    [Thr 01] *** ERROR => MsHttpPortBind: MsHttpCommInit (port=8100)
    [msxxhttp_mt. 3847]
    [Thr 01] *** HTTP port 8100 state CLOSED ***
    [Thr 01] MsHttpOwnDomain: own domain[1] = agr.chem.corp.local
    [Thr 01] ms/icf_info_server : deleted
    [Thr 01] *** I listen to port sapmsBWD (3600) ***
    [Thr 01] *** I listen to internal port 4711 (4711) ***
    Please help in the same
    Regards
    Chandravilas

    hi,
    About the "Java Dispatcher running but no server connected" message:
    /message/595478#595478 [original link is broken]
    Re: Dispatcher running but no server connected: J2EE Engine stopped
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/54cdc48d395f6ce10000000a1553f6/frameset.htm
    İnteresting blog:
    How to Change the Dispatcher Running, No Server Connected Message
    Best Regards

  • Please help with this issue "To Run a SSIS Package outside of Server Data Tools You must install Drived Column of Integration sercvies of higher" From C# app

     i have searched all over the google and here on MSDN(I have read all the threads related to my problem ) , i am new to SISS and doing my clg project ,
    I have this package which loads data from  dim tables to a fact table , my Package runs without any problem in BIDS (2012)
    I have installed SQl Server integration services on SQL and service is also running in services.msc,
    the problem comes when i execute my package using my C# application i am using MSDN Method to execute a SSIS package programmatically given here.
    "http://msdn.microsoft.com/en-us/library/ms136090.aspx"
    For loading my FactTable i have used a Derived columns  and some lookups , 
    Now if i don't use derived columns and looks ups and just use source and destination component then my package runs fine from my C# application but if i use derived columns or looks ups etc it gives the following error
    "Error in Microsoft.SqlServer.Dts.Runtime.TaskHost/SSIS.Pipeline: To Run a SSIS package outside of SQL Server Data Tools you must Install Derived Column of Integration services of higher"
    I am searching and trying to resolve this issue from previous 2 days but without any luck please help or guide me what is solution to this problem ,,i will be very thankful
    I have also found that integration services that are running on my system have version  10.0
    but the BIDS have version Version 11.0.3402.0
    IS this causing problem ?  if yes then what i have to do  ?

    Hi BlaxButt,
    The package is developed in SSDT installed by SQL Server 2012, so it is a SSIS 2012 package. However, the Integration Services you have installed is SQL Server 2008 R2 version. To run the package outside SSDT, you need SSIS 2012 installed. The reason why
    the package runs fine with only Source and Destination components is that such a simple package can be executed by the DTExec utility installed by SQL Server 2012 Data base Engine or Client Tools (SQL Server Import and Export Wizard). To run a package that
    uses other tasks/components outside SSDT/BIDS, the SSIS runtime is also required except the DTExec utility. To obtain the SSIS 2012 runtime, we have to install SSIS 2012 on the server where the package runs.
    Reference:
    http://stackoverflow.com/questions/19989099/getting-error-running-ssis-package-on-non-ssis-server
    Regards,
    Mike Yin
    TechNet Community Support

  • SSIS: To run a SSIS package outside of SQL Server Data Tools you must install SCR - DP1 Connections of Integration Services or higher

    We have SSIS installed on a machine that is not part of a cluster but it is accessible by the cluster.
    Our job we have running on the cluster is failing with the following error:
    Error: 2014-01-31 09:14:37.52     Code: 0xC000F427     Source: SCR - DP1 Connections  
    Description: To run a SSIS package outside of SQL Server Data Tools you must install SCR - DP1 Connections of Integration Services or higher.  End Error
    Any advice or information on how to resolve this would be great.
    Many Thanks.

    Hi NessaBella,
    Integration Services service is not a cluster-aware service, and does not support failover from one cluster node to another. Therefore, in a clustered environment, Integration Services should be installed and started as a stand-alone service on each node
    in the cluster.
    Based on the error message, it seems that SSIS is not installed on the cluster node on which the job was running. Although SSIS is installed on a machine that is not part of the cluster and can be accessed by each cluster node, the SSIS service installed
    on a remote server cannot be used a cluster node. So, please install the shared feature SQL Server Integration Services on each cluster node. Besides, if certain packages need to run in 32-bit mode in certain jobs and the SQL Server installed is 64-bit version,
    you also need to install BIDS/SSDT on the cluster node to get the 32-bit runtime of SSIS.
    References:
    Integration Services (SSIS) in a Cluster
    Loading and Running a Remote Package Programmatically
    Regards,
    Mike Yin
    TechNet Community Support

  • Error "To run a SSIS package outside of SQL Server data tools you must install task name used in package of Integration service or highter.

    Hello Team,
    I am trying to execute a SSIS package from web page. When i try to do that i am getting following error.
    "To run a SSIS package outside of SQL Server data tools you must install <task name used in package> of Integration service or highter."
    In my machine Integration Services are installed and its service is also in running state.
    Please help me on this.
    Thanks,
    Ramesh
    Thanks, Ramesh Arige

    The SSIS package developed using SSIS 2008 Server R2 and Integrations Services 10.0 is exists in my machine. Is this wrong configuration, please help me on this.
    I am using the below code copied from CodeProject
    Thank you so much for responding.
    Ramesh
    Thanks, Ramesh Arige
    Which way are you using from the provided blog? Using 1) C# Code or 2) C# and Stored Procedure?
    Cheers,
    Vaibhav Chaudhari
    MCP, MCTS, MCSA (SQL Server 2012)

  • JAVA SOCKET TIMEOUT WHEN GENERATING PDF TO ADS SERVER

    We are currently getting the error when attempting to generate the PDF from the thin portal BI Reports and recieved the JAVA SOCKET READ TIME OUT error and
    applied adjustments to the notes
    934725 and 826419 by changing the timeout sessions to 300, but still get the same timeout errors:
    Note: We changed ADUSER user type and password, passed rpcData test, RFC HTTP external connections to ADS server...so we've came a long ways and here we are now with the timeout errors...
    Any ideals???

    Hi
    when you reset password please select checkbox for password never expires.
    see the following notes :
    1.Note 944221 - Troubleshooting if problems occur in forms processing
    2.Note 811342 - Time Out exception when rendering to Adobe document service
    thanks
    Gopal

  • Is ds designer able to run a job against a remote job server?

    I looked around for a quite while and couldn't find anywhere it's mentioned that the ds designer can run a job against a job server running on another machine. To me it seems that the designer and DS Server Manager can only pick up local job servers. There is no way for they to specify the hostname of the remote machine having the job server running.
    Could anybody here help me out with this problem? Our environment has restriction that developers have no local admin privilege so they can't start a local job server as a Windows service. The only solution for us is to use the remote job server running on the dedicated server. BTW, we don't use Unix/Linux at all.
    thanks in advance.

    yes, Designer can run job on job server that is installed on different machine, the job server machine can be Linux\Unix or Windows
    for the remote job server to be visible in Desginer, you will have Register the local repository with the Remote job server
    to Register a Local Repository with a Remote job Server, go to remote job server machine
    open the Server Manager
    In the server Manager, go to the job server window, select the job server click on edit in this window you can associate as many local repository as you want with this job server
    restart the Desginer, login to the local repo that you have added to job server
    click on Tools->Options
    expand Designer node, click on Environment
    in the Default job Server drop down list you will see the remote job server
    please refer the technical maual for Adding Job server using Server Manager and also how to add repository to job server

  • I have a TCP server writen in java. it run

    I have a TCP server writen in java. it run stand-alone and should not exit.
    I want to add it to WLS startup, so I need not to start it by myself. But,
    it bolcked wls when the server try to start my TCP server class. How can I
    solve this problem. Can the startup class run backgroud?

    It is working for me if I open a second Firefox instance with its own profile by starting Firefox with the -no-remote command line switch.
    * http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
    * http://kb.mozillazine.org/Shortcut_to_a_specific_profile
    * http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox
    * http://kb.mozillazine.org/Bypassing_the_Profile_Manager
    Use the -no-remote command line switch to open another Firefox instance with its own profile and to run different Firefox instances simultaneously.
    * http://kb.mozillazine.org/Opening_a_new_instance_of_Firefox_with_another_profile

  • Integrating java application running on OC4J server with EP Iview

    Hi,
         I Want to Integrate Java Application running on OC4J server with my Enterprise portal
    Can any one please help me out in this??
    Regards
    Padma N

    Hi Padma
    Its possible to integrate a java application running in the other server with enterprise portal.In portal i think there is a IView template call Java application template.Using this generally we can do this.But in you case what type of a java application is it?Just a class or webapplication or a server side application.This you can also acheive using a webdynpro applications as these are very flexible with integration into EP.In webdynpro you can use suspend and resume plugs to navigate from one application to other application.I have given my ideas how to implement.But integration mainly depends upon your landscape and version compatibilities and type of the application you need to integrate.
    Hope this answer helps you in implementation.
    Regards
    Kalyan

  • Run SQL against Pointbase server

    After creating a new domain from domain template, I was asked to run a sql against the pointbase database ..
    I noticed the startPointBaseConsole.cmd does not start the database itself. Do you know how to start the pointbase in WLP10GR3??
    Thanks,

    Shouldnt need to as far as I remember for pointbase.
    In any case, if you open startWeblogic.cmd you should get the command to start up pointase
    In 10.2
    call "%WL_HOME%\common\bin\startPointBase.cmd" -port=%POINTBASE_PORT% -debug=%PB_DEBUG_LEVEL% -console=false -background=true -ini=%DOMAIN_HOME%\pointbase.ini >"%DOMAIN_HOME%\pointbase.log" 2>&1
    which should be same in 10.3 but I havent verified that

  • Sockets work on localhost but not remotely?

    hi there,
    I have created a simple multithreaded client / server program.
    The Server listens on port 2222 for clients. When a client connects - the client sends its ip address to the server and then disconects. More than 1 client can connect at the same time to the server and the server also listens continuasly. I have 2 problems with the program...
    a) the programs work on localhost but not on remote machines? (Well not over my LAN anyway).
    b) I am getting 2 lots of 'datain' when the server recieves an ip address from the client when the client should only send it once.
    The code is below - any help would be greatly appreciated.
    //TCPServer.java
    import java.io.*;
    import java.net.*;
    class TCPServer {
         public static void main (String args[]) throws IOException {
              ServerSocket serverSocket = null;
              boolean listening = true;
              try {
                   serverSocket = new ServerSocket(2222);
              } catch (IOException e) {
                   System.err.println("Could not listen on port: 2222");
                   System.exit(-1);
              System.out.println("Server Started...\n");
              while (listening)
              new TCPServerThread(serverSocket.accept()).start();
              serverSocket.close();
    //TCPServerThread.java
    import java.net.*;
    import java.io.*;
    public class TCPServerThread extends Thread {
        public Socket socket;
        public TCPServerThread(Socket socket) {
         super("TCPServerThread");
         this.socket = socket;
        public void run() {
                   try {
                   BufferedReader datain = new BufferedReader (new InputStreamReader
                        (socket.getInputStream()));
                        System.out.println("ip address recieved");
                        System.out.println (datain.readLine () + "\n");
                   } catch (IOException e) {
                        System.err.println("Cannot read in ip address\n");
                        e.printStackTrace(); // show the error
                        System.exit(-1);
         } //TCPClient.java
    import java.io.*;
    import java.net.*;
    class TCPClient {
         public static void main (String args[]) throws Exception
              String hostname;
              int portNumber;
              String portString;
              BufferedReader inFromUser =
                   new BufferedReader (new InputStreamReader(System.in));
                   System.out.println("What host would you like to connect to?");
                   hostname = inFromUser.readLine();
                   System.out.println("What port would you like to connect to?");
                   portString = inFromUser.readLine();
                   portNumber = Integer.parseInt(portString);
                   System.out.println("Connecting to port " + portNumber + " of " + hostname + "....\n");
                        Socket clientSocket = new Socket(hostname, portNumber);
                        Socket sock = new Socket (InetAddress.getLocalHost(), portNumber);
                        BufferedWriter dataout;
                        java.net.InetAddress i = java.net.InetAddress.getLocalHost();
                        System.out.println("Sending ip address...\n" + i.getHostAddress());
                             dataout = new BufferedWriter (new OutputStreamWriter (sock.getOutputStream()));
                                  dataout.write (i.getHostAddress());
                                  dataout.flush();
                                  sock.close();
                                       clientSocket.close();
                             }Oh, yeah - check out my site below, I am trying to write an audio streaming client / server in Java if anyone is interested in getting involved or just being nosey....
    http://www.projectg.dsl.pipex.com

    In your client you are creating two sockets (why?). One connected to localhost, the other connected to the host specified using readLine.
    If your client runs on the same machine you have started your server, you have two connects to your server instead of one.
    The ip adresse is sent using the socket connected to localhost. That is why it does not work on remote machines.
    Hope this helps.
    J&ouml;rg

  • Can you make Kerberos validate a ticket against the server?

    I do not know if what I am describing is possible/feasible - so please forgive my ignorance.
    I am trying to create a Kerberos single sign-on java desktop application (there is on webpage involved, and we does not try to log into other applications from there), using only the functionality built into Java (we are running Java 6.0), and on WIndows XP.
    The point of what we are trying to do is to archive the ability to
    1) Authenticate the user of the program, both for history keeping, but also to keep people who have no business out of our application (we do not explicitly need authorization, as this is taken care of internally in the application)
    2) Avoid any kind of log-in screen (in other words single sign-on, with the sign-on to the Windows user account as the first and only sign on).
    in that prioritized order.
    After having poking around for a while we finally got Kerberos in a semi working state - without any forms of external configuration files. However, the only way I have found to avoid having to deal with the CallbackHandler (which would mean we would need to have the user intervene - invalidating #2) has been to add the cachedTicket option.
    However, when I do so, there does not seem to be made any kind of validation against the server (the realm and KDC information can be freely set to gibberish - and it works even if the account that I do it from has been invalidated). This seems almost (I said almost) seems as unsafe as the "System.getProperty( "user.name" );" we started looking at in the beginning.
    If I have to go through the CallbackHandler then everything is OK (fails if the realm and KDC information is not correct - and likewise when my account has been deactivated, fails on any possible combination of bad password and/or username).
    So my question is: Is there a way to login securely, without having to prompt the user for his windows account and password (perhaps a special configuration). If so, do I need to use a keytab (we would prefer not to, but if that is what it takes....), should I look into authorization as a workaround (if it indeed could as such), using a third party Kerberos system (such as the one from FemiLab), something entirely different - or is what I am describing impossible?
    If needed I would be able to provide code snippets.
    Thank you for your time :)

    Hi,
    I've attached the llb file from the examples folder \LabVIEW\Examples\Comm
    This is a LabVIEW 5.1.1 folder but it should open in Ver 6 OK. But there maybe some links to other example VI.
    Regards
    Ray Farmer
    Regards
    Ray Farmer
    Attachments:
    comm.zip ‏335 KB

Maybe you are looking for

  • Possible to have two occurences of sliding panels in same location on page?

    Hi, any help you guys could give me would be greatly appreciated. I'm redesigning my portfolio page, and am trying to use the sliding panels widget for the two gallery areas. Ideally, when you click the links in the Design area on the left side navig

  • Update EKKO Z field using Inbound Idoc

    I have an requirement where  I have to update Z field in EKKO while creating PO using inbound Idoc. Basic Idoc Type: PORDC103 Function module: BAPI_PO_CREATE1 Extended POHEADER and EKKO with z field. I am using exit EXIT_SAPL2012_001 to populate Z fi

  • Steps for creating 0MATERIAL info-object

    Hi, Guys I need help for the below mentioned activities, I need detailed step by step guidance. Create a copy of 0MATERIAL info-object  (and name it as ZZY_MAT) with a minimum of 10 attributes (few navigational and few display). Create a transformati

  • Slow startup MacBook

    2009 MacBook Pro (now MacBook) is not starting up correctly. Taking hours to reach the login screen from the initial power up screen. It is unresponsive while booting up but will eventually reach the login screen if it is left alone for long enough.

  • FYI don't be afraid

    Just a FYI, There are many ipods that are now off warranty or have damage and are off warranty because of dents or heavy scratches. To those I write, hang in there. There are so many things that can be done by you to repair your own nano if you have