Client Freezes on socket() call

Hi,
I'm trying to write a client that will connect to a server on a specified port and return the banner if there is any. I've tested the client with a local server and it seems to work fine, but when i attempt to connect to a host on the internet it freezes and a connections is never established (it seems to hang on the socket() call).
This is the client codd:
import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class bannerGrab extends JFrame implements ActionListener
      * GUI components
     private JButton connectButton, exitButton;
     private JLabel portLabel, ipLabel;
     private JTextField portField, ipField;
     private JTextArea outputArea;
     private JScrollPane scroller;
      * Network Components
     private Socket clientSocket;
      * Sets up the GUI and make ready for network connection
     public bannerGrab()
          super("Banner Grab v1.0 - kl365");
          Container c = getContentPane();
          c.setLayout(new FlowLayout());
           * Set u GUI components
          portLabel = new JLabel("Port Number:");
          ipLabel = new JLabel("IP Address: ");
          portField = new JTextField(5);
          ipField = new JTextField(10);
          outputArea = new JTextArea(15, 30);
          outputArea.setLineWrap(true);
          outputArea.setWrapStyleWord(true);
          scroller = new JScrollPane(outputArea);
          connectButton = new JButton("Connect");
          connectButton.addActionListener(this);
          exitButton = new JButton("Exit");
          exitButton.addActionListener(this);
          c.add(portLabel);
          c.add(portField);
          c.add(ipLabel);
          c.add(ipField);
          c.add(scroller);
          c.add(connectButton);
          c.add(exitButton);
          setSize(350, 400);
          show();
     public void actionPerformed(ActionEvent e)
          if(e.getSource() == exitButton)
            System.exit(0);
          if(e.getSource() == connectButton)
            setupConnection();
      * takes care of the socket initialization, connection and msg retrieval
     public void setupConnection()
          int portNumber = 0;
          String host;
         if(ipField.getText().equals(""))
              outputArea.append("Please input host address/name\n");
              return;
         if(!ipField.getText().equals("") && portField.getText().equals(""))
              portNumber = 21;
              host = ipField.getText();
         else
             try
                  portNumber = Integer.parseInt(portField.getText());                  
             catch(NumberFormatException nfe)
                  JOptionPane.showMessageDialog(this, "Port Number must be Integer value", "Number Format Exception",
                       JOptionPane.ERROR_MESSAGE);
                  portField.setText("");
                  return;
              host = ipField.getText();         
          * Attempt to connect to server
          try
               clientSocket = new Socket(host, portNumber);
          catch(UnknownHostException uhe)
               JOptionPane.showMessageDialog(this, "Invalid Host Name", "Unknown Host",
                    JOptionPane.ERROR_MESSAGE);     
               return;          
          catch(IOException e)
               JOptionPane.showMessageDialog(this, e.toString());
               return;
          outputArea.append("\n*****************************************************\n");              
         outputArea.append("Attempting Connection to " + host + " on port " + portNumber + "\n");
         BufferedReader inputStream;
          * retrieve msg from server if any is present
         try
              inputStream = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
              String inputString = "";
              outputArea.append("Receiving Message:\n\n");
              while((inputString = inputStream.readLine()) != null)
                   outputArea.append(inputString);
         catch(IOException e)
              JOptionPane.showMessageDialog(this, e.toString(),
                   "IOException", JOptionPane.ERROR_MESSAGE);                  
              return;         
     public static void main(String args[])
          bannerGrab app = new bannerGrab();
          app.addWindowListener(
               new WindowAdapter()
                    public void windowClosing(WindowEvent e)
                         System.exit(0);
}thanks for the help,
kl365

By "socket() call" you mean "new Socket(host, port)"?
Make sure it's there the program hangs: surround the call with debugging print()s; get a stack trace while it's hanging (Unix: control-backslash, Windows: control-break). Check the host name. Try with a numeric IP address. Try if "telnet host port" can open the connection. Is there a firewall that blocks access to the port? Does the hang time out after e.g. one minute?

Similar Messages

  • Retrieving client identity during method call

    Hy,
    I have written an RMI application wich uses JSSE with client authentication. I would like to get the client Identity (Certificate information) each time the client perform a method call.
    Can anybody help me?

    This is rather complicated but it can be done. You need:
    1. an RMIServerSocketFactory which returns
    2. a wrapper ServerSocket implementation around a real ServerSocket, which delegates everything to the real ServerSocket except for the accept method, which does the delegation but then wraps the result in
    3. a wrapper Socket implementation around the real Socket which delegates everything to the real Socket
    except getInputStream, which does the delegation but then wraps the result in
    4. a wrapper InputStream implementation around the real InputStream, which delegates everything to the real input stream but which registers the underlying Socket (the delegate, not your wrapper) in a ThreadLocal when any read method is called.
    Are you with me so far? ;-)
    The registered Socket will really be an SSLSocket. Now, inside your remote method implementation, you can do threadLocal.get() to get the SSLSocket associated with the current client (because you're in the same thread as in (4), because the socket is actually read for the first time in the method despatching thread. You can now do SSLSocket.getSession() and get hold of the client certificates.
    Sample of (2) to get you started:
    public class WrappedServerSocket extends ServerSocket
    SSLServerSocket serverSocket;
    public WrappedServerSocket(int port) throws IOException
    { this.serverSocket = SSLServerSocketFactory.createServerSocket(port); }
    public Socket accept() throws IOException
      Socket socket = serverSocket.accept();
      return new WrappedSocket(socket);
    // all other methods should delegate to serverSocket
    }EJP

  • Problem defining a java client on tomcat to call the esb web service

    Dear Support,
    I have a java program that has been incorporated on the oracle SOA suite. We now have a problem defining a java client on tomcat to call the esb web service. The Oracle SOA part is running fine”.
    The software versions we are using :
    1 - Oracle SOA suite on 10.1.3.3 Oracle AS
    2 – Java 1.5
    3 – Tomcat 5.5
    4 – OS XP Professional

    If you have a main method in jour generated WSclient class (by the proxy) add the following code below the //add your own code:
    AddFileResponseType testResponse = myPort.addFile(testRequest);
    where AddFileResponseType is the responsetype of the WS and addFile is the method to call. this is just an example of my own webservice.
    Next stap is to put the cursor in the main method and choos debug or run.
    This should invoke the main method en call the webservice
    I hope this helps you
    Kim

  • IPhone 3G freezes after every call after 4.2 update

    There isn't much more to say other than that. As soon as I installed the 4.2 update my phone now freezes after every call. It stays frozen for hours, right now it's been frozen over 12 hours (screen is even still lit up). I'm tired of completely restoring my phone after every phone call!!!

    its nt a  casual evente in many iphone  3G with OS 4.2
    really apple is the responsable.
    we are honest users, and   we  need a  real answer.
    No reset the phone many tiemes, or  change the  phone.
    The  problem is  sorftware and internal politics in apple.
    no more  dirty play ...
    other  companies lets that a user continue  with  her  device, by 5 or more  years.
    an spencive  device  need to be by more time.
    why  apple  continue selling Iphone 3G? ...

  • [svn:fx-3.x] 7197: Bug: BLZ-354 -  Client still polling after calling ChannelSet.logout() when subscribed to messaging destination.

    Revision: 7197
    Author:   [email protected]
    Date:     2009-05-21 14:49:44 -0700 (Thu, 21 May 2009)
    Log Message:
    Bug: BLZ-354 -  Client still polling after calling ChannelSet.logout() when subscribed to messaging destination.
    QA: Yes
    Doc: No
    Checkintests: Pass
    Details: In polling channels, stop polling as soon as logout ack is received.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/BLZ-354
    Modified Paths:
        flex/sdk/branches/3.x/frameworks/projects/rpc/src/mx/messaging/ChannelSet.as

    Any advice would be helpful. Thanks

  • Z10 freezing after a call

    Hy guys
    my z10 freezing after a call....
    when i make a call after close it my z10 freezing and i have to reeboot...also if i received a call,when i close it my z10 freezing.....what can i do?why happened?
    before the new SO 10.2 never happen.,but since i installed the new SO 10.2 my z10 doesn't works well...
    please help me...

    Hi teojap,
    Welcome to the support community!
    This article may help resolve any issues you are experiencing since the update. "BlackBerry smartphone is unstable after an over the air update due to misaligned BlackBerry 10 OS and radio versions" http://blackberry.com/btsc/KB34666 Please make sure to backup your data before making any changes to the BlackBerry smartphone.
    Let me know if that helps.
    -FS
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.
    Click Solution? for posts that have solved your issue(s)!

  • My iPad Air always freezes during FaceTime calls using wifi. I switch to my iPhone 5c on the same wifi, and it never freezes while I'm sitting in the same location. Is there maybe a setting I have that is causes this? I am un to date on the OS also.

    My iPad Air always freezes during FaceTime calls using wifi. I switch to my iPhone 5c on the same wifi, and it never freezes while I'm sitting in the same location. Is there maybe a setting I have that is causes this? I am up to date on the OS 7.1.1. Video and audio is froze on my end, only video freezes on the other end. It doesn't make a difference who makes the call either.

    No, there isn't any setting that you are missing. Have you tried force closing FaceTime, and resetting your iPad?
    In order to close FaceTime, you have to drag the app up from the multitasking display. Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the app that you want to close and then swipe "up" on the app preview thumbnail to close it.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.
    If that does not make a difference, you could try resetting all settings, if you reset all settings you will have to enter all of the device preferences again in the settings app. That takes some time to accomplish, but you will not lose my data, media, apps or anything like that. Settings>General>Reset>Reset all settings.
    If that doesn't help, the next step would be to restore the iOS software. Backup your iPad first, restore the iOS, then restore the backup.
    Use iTunes to restore your iOS device to factory settings

  • How to print SOAP request at client program when program calls web service.

    Hi friends,
    While calling a web service, I am getting following error: javax.xml.rpc.JAXRPCException: Failed to parse WSDL
    I believe it is due to an invalid parameter set for the request soap. I need to analysis this error. Can you help me to print SOAP request at client program when program calls web service.
    Is there any way to print SOAP request XML?
    Thanks.
    Jaykishan

    Is this question related to Oracle SOA suite? Which client are you using? Use SOAPUI to validate whether WSDL is correct.
    Regards,
    Anuj

  • I have iPad air, screen freezes after FaceTime call and cannot get back to home screen, have to power down and turn back on to get back to home screen.  What am I doing wrong?

    I have iPad air, screen freezes after FaceTime call and cannot get back to home screen, have to power down and turn back on to get back to home screen.  What am I doing wrong?

    Hi RWD2,
    Welcome to the Support Communities!
    To resolve your issue with Facetime freezing when you end a call, I would try the first three steps in the article below. 
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/ts3281
    Resolution
    If a single application is not responding or stops responding when it opens, you can force it to close.
    If the device is unresponsive or if certain controls aren't working as expected, restart your device.
    If the device remains unresponsive or does not turn on (or power on), reset your device.
    If you are using Wi-Fi, it may be helpful to try these troubleshooting steps as well:
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/kb/TS1398?viewlocale=en_US
    Reset network settings by tapping Settings > General > Reset > Reset Network Settings.
    Note: This will reset all network settings including previously connected Wi-Fi networks and passwords
    iOS and OS X: Recommended settings for Wi-Fi routers and access points
    http://support.apple.com/kb/HT4199
    I hope this information helps ....
    Have a great day!
    - Judy

  • DAC Client Freeze often

    My dac client freezes on a regular basis (running on windows server on linux)
    No specific situations cause the lock - is random and often..
    I have 10.2.3.4.1.patch.20100105.0812 Build date: January 5 2010
    Any help would be appreciated.

    Latest Lockup while adding tables to Subjec Area:
    Stuck With Hour Glass
    2 Logs from today.
    PREVIEW_aljtest.txt
    Auto Generated Execution Plan for : aljtest
    DEPTH : 0
         xxafl_SDE_ORA_TransactionTypeDimension_Product(ORA_R11_AFL->DataWarehouse)(Extract Dimension) - 300001
    DEPTH : 1
         QUERY_INDEX_CREATION(DataWarehouse->DataWarehouse)(Query Index Creation) - 99900010
    Design_EP_alj.txt
    Adding Supply Chain - BOM Items
    Fetching directly related to the subject area : null
    Fetching extension tables to the subject area : null
    Fetching Tags applicable to the subject area : null
    Adding aljtest
    Fetching directly related to the subject area : null
    Fetching extension tables to the subject area : null
    Adding table xxafl_W_INVENTORY_PRODUCT_DS
    Fetching Tags applicable to the subject area : null
    Constructing the TableIndexHandler instance 27350423
    Loading Tables...
    Because the application identifier is not specified, the table refrence identifiers cannot be loaded.
    Loading Tables completed...
    Right before Table Visitor.
    LEAF NODES BEFORE ELIMINATION ARE:
    Empty Collection.
    LEAF NODES AFTER ELIMINATION ARE:
    Empty Collection.
    Verifying the position of any node who has reads and writes to the same tables.
    Right after Table Visitor.
    RIGHT BEFORE THE SINGLE TARGET TABLE VISITOR
    RIGHT AFTER THE SINGLE TABLE VISITOR
    RIGHT BEFORE THE BLOCKING VISITOR
    RIGHT AFTER THE BLOCKING VISITOR
    RIGHT BEFORE THE WAIT FOR VISITOR
    RIGHT AFTER THE WAIT FOR VISITOR
    RIGHT BEFORE THE READER-WRITER VISITOR
    RIGHT AFTER THE READER-WRITER VISITOR
    Total time taken : 0 minutes
    Nodes with no successers:
         xxafl_SDE_ORA_TransactionTypeDimension_Product(ORA_R11_AFL->DataWarehouse)
    Nodes with no predecessors:
         QUERY_INDEX_CREATION(DataWarehouse->DataWarehouse)
    Starting to prepare preview!
    Finished to prepare preview!
    Starting to write preview!
    Writing to file log\PREVIEW_aljtest.txt
    Finishing to write preview!

  • My iphone 3 keeps freezing cutting voice calls off.. any ideas

    My iphone 3 keeps freezing cutting voice calls off.. any ideas

    Thats just it. The seller had the listing as BRAND NEW iPhone 4.
    Then after the purchase he said that it was just replaced by apple, had the stickers from apple on it and everything.... honstly I wouldn't swear for the seller but thats what he had it listed as.
    He gave me the run around until my time to open a case was up... he even had me ship it back to him just to kill time. now I have it again. What looks to be a expensive paper weight.

  • After update to 4.3.5 i phone4 is getting freezed while a call came. cant listen anything. and then it is frezzing.After update to 4.3.5 i phone4 is getting freezed while a call came. cant listen anything. and then it is frezzing.

    After update to 4.3.5 i phone4 is getting freezed while a call came. cant listen anything. and then it is frezzing.

    Try rebooting the device by pressing and holding the on/off and home buttons simultaneously until the screen goes blank and you see the apple logo. It should take about 10-15 seconds to reboot.

  • Clients freeze on logout from OS X Server

    I have a persistent problem with clients freezing or locking up upon log out from the server. This problem requires a forced restart. I can't see any errors on the server. I want to enable AFP debugging but the only instructions I have from afp548 are very vague. Can anyone shed some light on this:
    If you set afpdebugsyslog to 1 (true), and add the following line to /etc/syslogd.conf,
    I'm fine with the syslog.conf; but how does one set afpdebugsyslog to 1 (true) and am I on the right track?

    Interesting, I have the same thing. One client on a system occaisonally get's "stuck" on log out. Or, they're stuck logging in. A restart of the machine fixes it, but is a pain. Nothing in the logs - my head is being scratched...
    10.4.7 server, 10.4.7 Intel client (iMac)

  • New Unlocked Centro Freezes when recieveing calls

    Please help.  My New Unlocked Centro Freezes when recieveing calls!!!  I have not loaded any additional softwares or even connected the Centro to any computer for a sync.  Please Help!!!  What could cause this?
    Thanks,
    Chuck
    Post relates to: Centro (Unlocked GSM)

    take a look at http://discussion.treocentral.com/showthread.php?t=166552&page=5
    Post relates to: Centro (AT&T)

  • SPA 512 phones locking up/freezing when another call comes in.

    It doesn't happen every time but several users are reporting phone freezing when another call comes in while they are on the phone.  We have two UC560's under one roof doing this, one using 3com switches and one using Cisco switches, the two (UC560) networks are completely segregated.  We have swapped out some phones thinking it might be a bad phone or two but the problem is still ongoing.  Phones are on the most current firmware that pulls automatically when they are first plugged in.

    Hello James,
    You have to upload the firmware via the drag and drop method in CCA. In the Topology View, use the mouse to drag the phone load (.zip or .bin) file from your PC and drop it onto the UC500 icon. For Cisco SPA500 Series and 300 Series phones, you must extract the .bin file from the archive before dragging and dropping it onto the UC. Make sure you can ping 10.1.10.2 which is the TFTP interface of the UC.
    Thanks,
    -john

Maybe you are looking for

  • How to track browser type in the access log

    I have looked through the documentation on logging features on how to log the browser type for visitors. Is there a straightforward way to do add this information to the access.log? We are using Weblogic Portal 7.0 sp4 Thank you.

  • Calling a web service from Session bean

    Hi Experts, Can anybody help in calling a web serivce frm a session bean's business method?? Hw do we do that? I have one requirement where i want to send emails to set of users for which i have email sending web service ready.. How can i call it thr

  • Convert a line read from text file into string

    how to convert a line from text file into string? i know how to convert to numbers, private int  parseLine1(String line) {           StringTokenizer tokenizer = new StringTokenizer(line);               value1 = Integer.valueOf(tokenizer.nextToken()).

  • Encoding video - keep getting error message when placing into indd?

    Hi, I have some video which I need to drop into an article, and I can't work out why I keep getting an error: Cannot preview the media: not connected to the Internet or the file is not on the server. It 'places' but nothing shows up in the frame or w

  • How to tilt graphs on a report

    Hi all, I developed a Funnel Graph report . I want it as vertical rather than as a horizontal view . So is there any way to achieve this ? if yes please do reply me