A Thread manages a connection from the outside--help me to finish it

**RUN THIS CODE AND HELP ME--- THANKS A LOT**
EchoClient is thread which manage a connection from the outside.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Random;
public class EchoClient extends Thread {
     private ServerSocket listenSocket = null;
     private Socket manageSocket = null;
     private int[] port = new int[9999];
     private BufferedReader in;
     private PrintWriter out;
     private int line;
     private int count;
     // No needed to mention
            //private ClientNode[] clientArray = new ClientNode[9999];
     private ManageClient[] manageClient;
     private final int CONNECTED = 1;
     private final int CONNECTING = 11;
     private final int DISCONECTED = 2;
     public void run() {
          try {
               manageClient = new ManageClient[9999];
               listenSocket = new ServerSocket(903);
               manageSocket = listenSocket.accept();
               while (true) {
                    in = new BufferedReader(new InputStreamReader(manageSocket
                              .getInputStream()));
                    out = new PrintWriter(manageSocket.getOutputStream());
                    line = in.read();
     // if Client send a variable(CONNECTING)
            // Server will send to Client a variable(CONNECTED) and port
            //to open a ChatFrame with that port
                    if (line == CONNECTING) {
                         System.out.print("have recieved");
          out.print(CONNECTED);
                     //randomize a port to send to client
          port[count] = (int) Math.ceil(Math.random() * 9999)
                    //creat a manageClient(Thread) to manage a seperate
                   // connection with a seperate Client
                         manageClient[count] = new ManageClient(port[count]);
                         manageClient[count].start();
                         out.print(port[count]);
                         count++;
          } catch (Exception e) {
               e.printStackTrace();
     public static void main(String[] args) {
          EchoClient e = new EchoClient();
          e.start();
}And a Login Frame which will send to server a varialble (CONNECTING) which requires to connect and keep waiting for a variable to Open a ChatFrame with a new port
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
public class Login extends JFrame {
     public ChatFrame chatFrame;
     private final int CONNECTED = 1;
     private final int CONNECTING = 11;
      * @param args
     public Login() {
          // TODO Auto-generated method stub
          setSize(50, 150);
          JButton loginButton = new JButton("Login");
          JPanel p = new JPanel();
          p.setLayout(new FlowLayout());
          p.add(loginButton);
          add(p);
          loginButton.addActionListener(new ActionListener() {
               @Override
               public void actionPerformed(ActionEvent e) {
                    loginServer();
     public void loginServer() {
          try {
               Socket connectSocket = new Socket("127.0.0.1", 903);
               while (true) {
                    BufferedReader in = new BufferedReader(new InputStreamReader(
                              connectSocket.getInputStream()));
                    PrintWriter out = new PrintWriter(connectSocket
                              .getOutputStream());
                    out.print(CONNECTING);
                    System.out.println("At here");
//(***position***)
                    int line = in.read();
                    System.out.println("At here1");
                    if (line == CONNECTED) {
                         int port = in.read();
                         chatFrame = new ChatFrame(port);
                         chatFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                         chatFrame.show();
                         connectSocket.close();
          } catch (Exception exp) {
               exp.printStackTrace();
     public static void main(String[] args) {
          Login login = new Login();
          login.show();
          login.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}and this is ManageClient Thread...
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class ManageClient extends Thread {
     private ServerSocket ssClient;
     private Socket sClient;
     private int port;
     public ManageClient(int port) {
          this.port = port;
     public int getPort() {
          return port;
     public void run() {
          try {
               ssClient = new ServerSocket(getPort());
               sClient = ssClient.accept();
               while (true) {
                    BufferedReader in = new BufferedReader(new InputStreamReader(
                              sClient.getInputStream()));
                    PrintWriter out = new PrintWriter(sClient.getOutputStream());
                    String s = in.readLine();
                    if (s != null)
                         out.print("have recieved");
          } catch (Exception e) {
               e.printStackTrace();
}my problem...
At firts EchoClient will run.. and then Login but when I click to the Login button it has just only did before int line = in.readLine();(*** postion ***)
I don't know why it doesn't continue. It stops here and the login button is still visible(cause code has not finish)..
That's my problem...
Somebody help me
Edited by: rockfanskid on Oct 17, 2007 4:25 AM

Somebody helps me to finish this project...
thanks for racing this thread

Similar Messages

  • Open script cannot get connection from the brower helper after 15 seconds.

    Error:
    ===
    Open script cannot get connection from the brower helper after 15 seconds. Do you want to continue waiting for the browser to load?
    Please Note:
    ========
    1. I have tried this only on IE
    2. I am running OATS on a Remote desktop
    Situation:
    ======
    Trying to stop the recording
    Try to get xpath of an object using Inspect Path
    Setup details
    ========
    Windows XP 5.1 Service Pack 3, x86
    OpenScript 12.1.0.1.383
    Internet Explorer 8.0.6001.18702
    FireFox 13.0.1
    Mitigation steps done till now:
    ==================
    1. Disabled windows firewall
    2. Disable XSS filter setting
    3. Restarted the ATS services (3 of them)
    4. Run the Open Script Diagnosis Tool (PS: There are 3 errros even after running it. The 3 errros are listed in the workspace_log log file snippet below...)
    Error in worspace_log:
    =============
    To Change setting:
    Go to Tools > Internet Options and Choose Security Tab
    Select the Zone to modify and Press Custom level
    Find Enable XSS filter Setting - Select Disable and click Ok
    !ENTRY oracle.oats.scripting.diagnosisTool.api.DiagnosisExecutor 4 0 2012-07-09 17:08:52.594
    !MESSAGE Failure found when diagnosing Oracle EBS/Forms Load Testing Forms LT Diagnoser
    !ENTRY oracle.oats.scripting.diagnosisTool.api.DiagnosisExecutor 4 0 2012-07-09 17:08:52.594
    !MESSAGE Did not auto-fix the problem.
    !ENTRY oracle.oats.scripting.diagnosisTool.api.DiagnosisExecutor 4 0 2012-07-09 17:08:52.594
    !MESSAGE Suggestion for fixing: Please change your Java proxy setting to Use Browser Settings
    Aprreciate help on this.

    To resolve this, you need to reconfigure the "Oracle Application Testing Suite Helper Service" (OATSHelperSvr) to start as a user who has privledges to run open script tests rather than the default SYSTEM user.
    Reconfiguring the OATSHelperSvr Service:
    1. Open the services panel (Start > Run > services.msc)
    2. Find the Oracle Application Testing Suite Helper Service
    3. Right Click > Properties then select the Log On Tab
    4. Specify an interactive user that has rights to run OpenScript (test by logging in as that user and running tests):
    5. Click OK
    6. Restart the service after dialogs are closed by Right Click > Restart
    7. You should now repeat this process for the "Oracle Application Testing Suite Agent Service" (eLoadAgentMon) Service (Two services in
    total)
    You should now retry running the test in Oracle Test Manager

  • "Configuration Manager cannot connect to the site" after site update from SP1 to R2

    Our dev SCCM environment only has a single primary site with a remote SQL database.  Initially, the dev primary site had SP1 Beta (5.00.7782.1000) installed but as everyone is aware there is no upgrade path available to SP1 or R2 from Beta; so, we uninstalled
    the site and removed the database, re-installed SP1 non-Beta (5.00.7804.1000), then proceeded to update all devices with the latest client agent.  Afterwards, we attempted to upgrade the site from SP1 non-Beta (5.00.7804.1000) to R2 (5.00.7958.1000).
     All seemed well until we attempt to open the Configuration Manager console and we get the following error message:
    Configuration Manager cannot connect to the site (Site Name)
    The Configuration Manager Administrator console could not connect to the Configuration Manager site database. Verify the version of the console is compatible with the version of the site server you are connecting to and then try to connect again.
    So we tried reinstalling the console directly from here...
    "C:\Program Files\Microsoft Configuration Manager\tools\ConsoleSetup\AdminConsole.msi"
    still the same error message persisted, so we tried installing it from here...
    "C:\Program Files\Microsoft Configuration Manager\tools\ConsoleSetup\ConsoleSetup.exe"
    still the same error message persisted, so then we tried installing it directly from the R2 (5.00.7958.1000) installation media, and afterwards the same error message persisted....
    All along, we were checking the AdminConsole log from here:
    "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\AdminUILog\SmsAdminUI.log"
    Here are the contents:
    [4, PID:4836][04/22/2014 15:21:10] :Property: 'Features'\r\nSystem.Management.ManagementException\r\nNot found \r\n   at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
       at System.Management.PropertyData.RefreshPropertyInfo()
       at System.Management.PropertyDataCollection.get_Item(String propertyName)
       at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlResultObjectBase.get_Item(String name)\r\nManagementException details:
    [4, PID:4836][04/22/2014 15:21:10] :ReadExtraProperties: Failed to initialize extra properties
    [4, PID:4836][04/22/2014 15:21:11] :Transport error; failed to connect, message: 'The Configuration Manager Administrator console could not connect to the Configuration Manager site database. Verify the version of the console is compatible with the version
    of the site server you are connecting to and then try to connect again.'\r\nMicrosoft.ConfigurationManagement.ManagementProvider.SmsConnectionWithDetailException\r\nThe Configuration Manager Administrator console could not connect to the Configuration Manager
    site database. Verify the version of the console is compatible with the version of the site server you are connecting to and then try to connect again.\r\n   at Microsoft.ConfigurationManagement.AdminConsole.SmsSiteConnectionNode.ValidateConnectionParameters(ConnectionManagerBase
    connection)
       at Microsoft.ConfigurationManagement.AdminConsole.SmsSiteConnectionNode.GetConnectionManagerInstance(String connectionManagerInstance)\r\nNo details are available for this error.\r\n
    Once again, we validated we could connect to the SQL database from this box, and that the console was at the same version as the site.  Any help or guidance with getting our access to the console restored after the SP1 to R2 upgrade would be greatly
    appreciated. 

    From the Primary Site Server, I tried uninstalling the Admin Console and re-installing using:
    consolesetup.exe /q TargetDir="%ProgramFiles%\Microsoft Configuration Manager" EnableSQM=0 DefaultSiteServerName=<SiteServerName>
    Of course replacing <SiteServerName> with the FQDN of my Primary Site Server.  Console installed successfully however the same error message persists.
    Also tried installing the console on a clean Windows Server 2008 R2 installation.  I tried it from the R2 (5.00.7958.1000) installation media, from the "C:\Program Files\Microsoft Configuration Manager\tools\ConsoleSetup\" both without any luck, the
    same error message persists.  I verified I could ping the FQDN of the site server also, and that the firewall between the two permits communication over the ports listed here: http://technet.microsoft.com/en-us/library/hh427328.aspx
    Any help would be greatly appreciated.

  • I have a new MAC MINI and I want to install a second monitor.  I have one connected to the HDMI and it works.  I can't get a signal to the other one.  It is connected from the thunderbolt to its HDMI port.  How can I make it work?

    I have a new MAC MINI and I want to install a second monitor.  I have one connected to the HDMI and it works.  I can't get a signal to the other one.  It is connected from the thunderbolt to its HDMI port.  How can I make it work?

    Could be a bad cable or bad Thunderbolt port.
    You have 90 days of free telephone support on a new device. You can call them at 1-800-MY-APPLE. Have your Mini's serial number handy
    You can also make an appointment at the Genius Bar of an Apple store.
      Apple Retail Store - Genius Bar

  • SharePoint - Error_1_Error occurred in deployment step 'Add Solution': Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was rea

    Hi,
    I am Shanmugavel, SharePoint developer, 
    I am facing the below SharePoint 2013 deployment issue while deploying using VS2012.
    If i will deploy the same wsp or existing wsp
    (last build) using direct powershell deployment, the solution adding properly, but the same timeout exception coming while activation the features.  Please find the below error.
    I tried the below activists:
    1. Restarted my dev server, DB server. 
    2. tried the same solution id different server
    3. tried existing wsp file (last build version)
    4. Deactivated all the features, including project Active deployment configuration.... but still i am facing the same issue.
    I hope this is not coding level issue, because still my code is not start running, before that some problem coming.
    Please help me any one.....  Last two days i am struck because of this...

    What you need to understand is the installation of a WSP does not do much. It just makes sure that you relevant solution files are deployed to the SharePoint farm.
    Next comes the point when you activate the features. It is when the code which you have written to "Activate" certain features for your custom solution.
    Regarding the error you are getting, it typically means that you have more connections (default is I guess 100) open for a SQL database then you are allowed to.
    If you have a custom database and you are opening a connection, make sure you close it as well.
    Look at the similar discussion here:
    The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool
    size was reached[^]
    I would suggest further to look at the
    ULS logs[^] to get better insight.
    Manas Bhardwaj's Stream : www.manasbhardwaj.net

  • I am trying to manage my media from the computer but it keeps saying my session has timed out and I've tried it so many times. How can I successfully manage my media?

    I am trying to manage my media from the computer but it keeps saying my session has timed out and I've tried it so many times. How can I successfully manage my media?

        Hi Valeria07,
    We want managing your media to be easy! It saddens me to hear that this is not occuring. Do you receive a specific error message when the browser times out? Have you tried using a different browser?
    Thanks,
    PamelaF_VZW
    Tweet us @vzwsupport

  • How to Destory connections from the Pool?

    Hi,
    I would like to know if it is possible to destroy/refresh a connection id from the DBPool using just a javacode that either refresh the whole pool or just one specific connection.
    We are using a DB cluster environment and once one of the Database Servers goes down, the connection continues to point to the old DB Server. We are testing if the connection is still pointing to a valid DBServer (using a simple <i>select getdate()</i> statement (the DBMS is SQLServer 2000). The problem is that even if we close the connection object in the JavaCode, the physical connection still points to the old DB IP address, and we want to kill that connection from the DBPool.
    We know that once the connection id is destoyed(using the DESTROY_CONN command of the J2EE engine), a new connection is created for the right DB Server.
    We are using the following versio of EP:
    6.0.2.37.0.Enterprise_Portal_Support_Package_2
    Thanks.

    Hi,
    There is no difference in calling a transaction from module pool and report . The statement
    Call transaction tranaction name works similarly in both the cases . The only thing you need to take care is your program flow in Module pool.
    For calling transaction set the parameters of the transaction and on using the call transaction statement it will call the transaction withe the set values. use skip initial screen option to execute it from your program. This entire code needs to be written in PAI event where you will be handling your OK codes.
    Hope this helps.

  • What do I need to open a connection from the Linux box to the Oracle server

    Hi all,
    I want to access oracle database from java application running on Linux.
    The database is installed on a Window 2000 machine. What do I need to install before I can open a connection from the Linux box to the Oracle server on Windows 2000 ?
    Do I need Oracle Client ?
    Thanks,
    Quoi

    Hi Quoi,
    http://myjdbc.tripod.com/basic/jdbcurl.html
    Talks abt how to write a jdbc url and the jar + config required to connect to db. Also has a sample program to connect.
    Regards
    Elango.

  • Best Practices for configuring ICMP from the outside

    Question,
    Are there any best practices or best recommendations on how ICMP should be configured from the outside? I have been cleaning up the rules on our ASA as a lot were simply ported over years ago when we retired our PIX. I noticed that there is a rule to allow ICMP any any and began to wonder how this works when the rules above are specific IP addresses and specific ports. This in thurn started me looking to see if there was any documentation or anything to help me determine a best practice. Anyone know of anything?
    As a second part how does this flow on a firewall if all the addresses are natted? It the ICMP traffic simply passed through the NAT and the destiantion simply responds?
    Brent                   

    Here you go, bro!
    http://checkthenetwork.com/networksecurity%20Cisco%20ASA%20Firewall%20Best%20Practices%20for%20Firewall%20Deployment%201.asp#_Toc218778855
    access-list inside permit icmp any any echo
    access-list inside permit icmp any any echo-reply
    access-list inside permit icmp any any unreachable
    access-list inside permit icmp any any time-exceeded
    access-list inside permit icmp any any packets-too-big
    access-list inside permit udp any any eq 33434 33464
    access-list deny icmp any any log
    P/S: if you think this comment is useful, please do rate them nicely :-)

  • [SOLVED] Can't access my home server from the outside

    Hi all,
    I have installed Arch on a Raspberry Pi and am trying to set up a home server. Right now, I am running a simple HTTP server (using node.js, if that matters) on port 8080. From my LAN, I can access the server all right.
    From the outside, it seems that the traffic does actually reach the computer (I conclude this from the blinking diode indicating network traffic). However, all requests time out. Interestingly, if I kill the server while a request is pending, the timeout occurs right away.
    I have no idea what is causing this. I have checked for iptables rules, but there seem to be none. What is blocking the traffic and how can I find out?
    EDIT: Nevermind, I was testing incorrectly -- the traffic did reach the Raspberry Pi, but the return traffic did not reach my test computer because it was blocked by the router's firewall. Testing from TOR works just fine.
    Last edited by MrAllan (2013-12-24 12:01:42)

    I too am having problems accessing Directory server from Netscape Console installed on Winxp.
    If I try to open Directory server it doesn't give any error. No windows nothing.
    If I try th same from the machine on which it is installed everything is fine. What is strange is that it did open a couple of times. But at the same time I can open the admin server, Netscape Messaging server from the xp box. Searching all over for a solution. Any help/pointers would be greatly appreciated.
    Config details:
    iDS4.13, iMS 5.0, running on Sol 8 box
    Netscape Console 4.2 on WinXP.
    Thanks

  • TS1363 my iphone 4 doesnt show up in itunes. it is also locked on the 'connect to itunes screen' when unplugged from the computer. help me!

    my iphone 4 doesnt show up in itunes. it is also locked on the 'connect to itunes screen' when unplugged from the computer. help me!

    Close your iTunes,
    Go to command Prompt -
    (Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
    (Win XP SP2 &amp; above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
    In the "Command Prompt" screen, type in
    netsh winsock reset
    Hit "ENTER" key
    Restart your computer.
    If you do get a prompt after restart windows to remap LSP, just click NO.
    Now launch your iTunes and see if it is working now.
    If you are still having these type of problems after trying the winsock reset, refer to this article to identify which software in your system is inserting LSP:
    iTunes 10.5 for Windows: May see performance issues and blank iTunes Store
    http://support.apple.com/kb/TS4123?viewlocale=en_US

  • I feel that other people use my computer from the outside without my permission. How do we know?

    I feel that other people use my computer from the outside without my permission. How do we know?
    Thanks for your help

    First thing to do is find the information you received on your internet service, which should have the info on logging in to your router itself.  Login, usually from a browser like Safari, and find where to change the admin password, not the netowrk or WiFi password.  Change the admin password from the factory default, and write it down so you don't forget it...if there is ever a problem with your service you have to have that.
    Once the router is secure, on your iMac how do you operate?  Did you just set it up out-of-the box without adding user accounts?
    With the router secure there is little risk of an intruder using your equipment...but it would be worth it to change your network password, especially the wireless part of the network, and to check to see what security method is being used.  The most secure is WPA2.

  • Blocking unsolicited echo-reply from the outside of firewall

                       What is the easiest way to stop unsolicited icmp echo-reply packets coming from the outside of an Cisco ASA 5500 firewall?

    Hi,
    The firewall should now allow any ICMP Echo replys through the firewall if it hasnt seen a Echo for that same reply.
    Instead of allowing Inbound ICMP from the WAN with an ACL you should configure ICMP Inspection
    In a very default ASA configuration they would be added in the following way
    policy-map global_policy
    class inspection_default
      inspect icmp
      inspect icmp error
    Hope this helps
    - Jouni

  • Reaching Tomcat from the outside

    I've just installed tomcat on my Win2000Pro box. Wish I had a Win2000Server though.
    I wanna reach it from the outside.
    This
    http://localhost:8080 gives me tomcat
    This though
    http://321.321.321.321:8080
    doesn't give me anything! (Let's assumes my ip is 321.321.321.321)
    What do I need to do in order to serve the entire net?
    Duke dollars to the first who gives me a valid tip.
    Morten Hjerl-Hansen

    When tomcat is running it is acting as a webserver on port 8080 (by default). So if it is not serving documents from other computers in your LAN, WAN or whatever, the problem is not with tomcat but with the network set-up itself.
    Can you ping 321.321.321.321?
    The only thing I can think of why this is not working is that you changed server.xml and setup one or more virtual hosts(With the Host directives) but failed to setup 321.321.321.321 also. Is this the case?
    Ylan

  • Is it possible to get a worse connection from the ...

    Just asking has I tried this earlier and I got a worse connection from the master than the normal. I've been told this is impossible.

    The new type NTE master socket has filters built in ... if you're getting better performance from an extension socket (+filter) , I'd get the master replaced.
    And if I was doing that, I'd have a broadband splitter v1 socket front fitted, tend to be better and negate the use of further filters on extensions. Segregates the phone connection from the broadband.

Maybe you are looking for