Server Socket unable to write

Hi friends,
I have a stock server application and clinet.i send latest stock values to all the JAVA bases clients.My problem is,after some time, UL clients are not getting any values from server and server stack trace gives following values:
"LobbyUpdater" prio=1 tid=0x824ebd0 nid=0x727d runnable [0x6a505000..0x6a505870]
at java.net.SocketOutputStream.socketWrite(Native Method)
at java.net.SocketOutputStream.write(SocketOutputStream.java:91)
at java.io.ObjectOutputStream.drain(ObjectOutputStream.java:1458)
at java.io.ObjectOutputStream.writeUTFBody(ObjectOutputStream.java:785)
at java.io.ObjectOutputStream.outputString(ObjectOutputStream.java:729)
at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(ObjectOutputStream.java:446)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:356)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1822)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:475)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1209)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:361)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1822)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:475)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1209)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:361)
at java.io.ObjectOutputStream.outputArray(ObjectOutputStream.java:1093)
at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(ObjectOutputStream.java:451)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:356)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1822)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:475)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1209)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:361)
at java.io.ObjectOutputStream.outputArray(ObjectOutputStream.java:1093)
at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(ObjectOutputStream.java:451)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:356)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1822)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:475)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:1209)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:361)
at com.cysphere.core.ctcontroller.bo.AbsMsgProcessor.sendResponse(Unknown Source)
at com.cysphere.core.ctcontroller.bo.MsgSender.sendMessage(Unknown Source)
at com.cysphere.core.ctcontroller.util.BridgeServerMsgUtil.sendLobbyInfoToBridge(BridgeServerMsgUtil.java:39)
at com.cysphere.core.ctcontroller.tournament.TournamentManager$LobbyUpdater.sendUIMessages(TournamentManager.java:288
Its keeps waiting at java.net.SocketOutputStream.socketWrite(Native Method)
forever and socket write never returns back.
Hope someone to put some light on this deadlock.(y can this happen??)
One more query:
What happens if server is contineously writing object message on socket as
oo.writeObject(o);//oo is ObjectOutputStream
oo.flush();
oo.reset();
but client is not reading it contineously or stuck somewhere???
what il be the behaviour of clinet and server in these circumstances??
All kind of suggestions/advise/briefing on topic will be wecome
thanks
kumar vinit

If the write method blocks its most likely because the client has stopped reading and all the buffers in the TCP stack are full. This is why you need separate threads for read and write, both can block.

Similar Messages

  • Administrators unable to write to a text file created by another Administrator on Windows Server 2008.

    Why are Administrators unable to write to a text file created by another Administrator on Windows Server 2008?
     --- The Administrators already have full control so how do I fix this? ---
    Example:  On a Windows Server 2008 (SP1): user A (who belongs to the Administrators group) logs in and creates a directory C:\foo and creates a file readme.txt in the foo directory.  User B (also a member of the Administrators group) logs in and opens C:\foo\readme.txt in notepad. User B types something and tries to save the file. User B cannot save the file…an option to save as some other file name is presented. The security permissions of C:\foo\readme.txt show that Administrators have full control.  
    Work around 1: Explicitly add user B to have full control over the foo directory. The problem is that all the all other Administrators still need to be added (current and future).
    Work around 2: Change the Users security permission to be full control on the foo directory. (this seems dangerous!)
    It is interesting to not that this same procedure is not a problem in Windows Vista. (Any insight about the difference?)
    Sincerely,
    Ian 

    so there is no way to change this without literally shutting down the UAC?
    I have files that  I need to modify all the time, and it is very annoying to have to save as to my desktop modify and then copy and paste the file again.
    I would also rather not give myself permissions to the entire C:\ Drive even specified Folders or documents, etc......
    You can change these settings without bringing down the UAC
    <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt; mso-ascii-font-family:Calibri; mso-fareast-font-family:Calibri; mso-hansi-font-family:Calibri;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} -->
    1.    Click Start, type gpedit.msc and press Enter.
    2.    Expand Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Security Options.
    <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt; mso-ascii-font-family:Calibri; mso-fareast-font-family:Calibri; mso-hansi-font-family:Calibri;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} -->
    3.    Double-click “User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode” on the right pane.
    a.    Choose “Elevate without prompting” and click OK.
    b.    Double-Click “User Account Control: Admin Approval Mode for the Built-in Administrator account”, Click Enable, Apply and then OK
    c.     Double-Click “User Account Control: Run all users, including administrators, as standard users”,Click Enable, Apply and then OK
    Then reboot the Server. You should now have the ability to modify any document, etc....

  • Error starting ORMI-Server.  Unable to bind socket: Address already in use:

    hi,
    I run the folowing command "start_oc4j.bat" to start Oc4j.
    It starts successfully.
    Then I start "BPEL PM Server".
    I get the following error,
    "Error starting ORMI-Server. Unable to bind socket: Address already in use: JVM_Bind".
    I understand the above errror because both of them are trying to bind to the same port. And both of them are trying to start ORMI server. Can some one suggest how to get rid of this problem.
    I tried giving different port numbers for them, but that did not work. Let me know, how to over come this problem.
    with regards
    shaila

    You may have another OC4J running on your computer.
    You should change the port number in the file config/rmi.xml.

  • "Error Starting OMI-Server. Unable to bind socket.Permission denied. Listen

    Hi All,
    I Installed Forms 1o-g successfully on my mishon ( Version windows vista), when i try to connect Forms i got error
    like this *"Error Starting OMI-Server. Unable to bind socket.Permission denied. Listen*
    Plz Anyone help....
    Thanks
    sa.....

    Which version of Windows Vista? Bear in mind that Vista home edition is not supported by Oracle (I think for all products). If that is the case, you should be upgrading your OS to business or ultimate edition.
    If that is not the case, please get in touch with Oracle support. Not much is available on internet or in forums (as you seem to have posted this in Forms forum as well).

  • Error starting ORMI-Server. Unable to bind socket...

    One of our BPEL App Servers was moved from a local network to a LAN. I believe it's IP was changed. When we start it with opmnctl startall we get the following error message:
    bq. Error starting ORMI-Server. Unable to bind socket: Cannot assign requested address
    There does not seem to be a resource issue with regard to ports. A netstat -p doesn't show any potential port conflicts. In a WEB search I came across the following suggested check:
    bq. Solution: \\ *A) Check if your IP address or hostname is changed or if there is a conflict of resources in the network*
    Can someone explain what needs to be fixed if the IP Address or hostname of the BPEL App Server has changed? What files need to be corrected to get the install to startup.

    You may have another OC4J running on your computer.
    You should change the port number in the file config/rmi.xml.

  • BEA-002606 Unable to create a server socket for listening on channel

    Hi,
    I am trying to stand up JDEVELOPER suite 11.1.2 on Windows 7 64 Bit.
    When I sreate a sample app and try to compile, I get the error:
    <Error> <Server> <BEA-002606> <Unable to create a server socket for listening on channel "DefaultSecure". The address 192.168.56.101 might be incorrect or another process is using port 7102: java.net.BindException: Cannot assign requested address: JVM_Bind.>
    This IP is not active on my machine, although it was initialized at one point through a VBox instance I installed. I have tried to clean off the VBOX instance and the JDEVELOPER, rebooting between loads. Can anyone help me get what look like a ghost IP off my machine. Note: I set the weblogic server to port 8003, so I am also not sure why itis looking at port 7002.
    Thanks
    JT

    It is the integrated server. I have taken everything off (JDev adn VBOX) and cleaned some of the hard to find file structures just to make sure there wasn't a hidden config file I was missing.
    I am new to Web Logic, so I was hoping to get the integrated server running first and then learn the ins and outs of deployment to a production system.

  • How to detect client socket shutdowns in server socket

    Hi,
    Hoping to get some help with this. I am writing this program that implements a socket server that accepts a single client socket (from a third-party system). This server receives messages from another program and writes them to the client socket. It does not read anything back from the client. However, the client (which I have no control over) disconnects and reconnects to my server at random intervals. My issue is I cannot detect when the client has disconnected (normally or due to a network failure), hence am unable to accept a fresh connection from the client. Here's my code for the server.
    ServerSocket serverSocket = null;
    Socket clientSocket = null;
    PrintWriter out = null;
    BufferedReader in = null;
    try{
              if (serverSocket == null){
                    serverSocket = new ServerSocket(4511);
         clientSocket = serverSocket.accept();
         System.out.println("Accepted client request ... ");
         out = new PrintWriter(clientSocket.getOutputStream(), true);
         in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
         System.out.println("Input / Output streams intialized ...");          
         while (true){                              
              System.out.println("Is Client Socket Closed : " + clientSocket.isClosed());
              System.out.println("Is Client Socket Connected : " + clientSocket.isConnected());
              System.out.println("Is Client Socket Bound : " + clientSocket.isBound());
              System.out.println("Is Client Socket Input Shutdown : " + clientSocket.isInputShutdown());
              System.out.println("Is Client Socket Output Shutdown : " + clientSocket.isOutputShutdown());
              System.out.println("Is Server Socket Bound : " + serverSocket.isBound());
              System.out.println("Is Server Socket Closed : " + serverSocket.isClosed());
              messageQueue = new MessageQueue(messageQueueDir+"/"+messageQueueFile);
              //get Message from Queue Head (also removes it)
              message = getQueueMessage(messageQueue);
              //format and send to Third Party System
              if (message != null){
                             out.println(formatMessage(message));
                   System.out.println("Sent to Client... ");
              //sleep
              System.out.println("Going to sleep 5 sec");
              Thread.sleep(5000);
              System.out.println("Wake up ...");
    }catch(IOException ioe){
         System.out.println("initSocketServer::IOException : " + ioe.getMessage());
    }catch(Exception e){
         System.out.println("initSocketServer::Exception : " + e.getMessage());
    }I never use the client's inputstream to read, although I have declared it here. After the client is connected (it enters the while loop), it prints the following. These values stay the same even after the client disconnects.
    Is Client Socket Closed : false
    Is Client Socket Connected : true
    Is Client Socket Bound : true
    Is Client Socket Input Shutdown : false
    Is Client Socket Output Shutdown : false
    Is Server Socket Bound : true
    Is Server Socket Closed : false
    So, basically I am looking for a condition that detects that the client is no longer connected, so that I can bring serverSocket.accept() and in and out initializations within the while loop.
    Appreciate much, thanks.

    Crossposted and answered.

  • Reading text from server socket stream

    I have a basic cd input program i've been trying to figure out the following problem for a while now, the user enters the artist and title etc and then a DOM (XML) file is created in memory this is then sent to the server. The server then echos back the results which is later printed on a html page by reading the replys from the server line by line.
    The server must be run it listens for clients connecting the clients connect and send DOM documents through the following jsp code.
    <%@page import="java.io.*"%>
    <%@page import="java.net.*"%>
    <%@page import="javax.xml.parsers.*"%>
    <%@page import="org.w3c.dom.*"%>
    <%@page import="org.apache.xml.serialize.*"%>
    <%!
       public static final String serverHost = "cdserver";
       public static final int serverPort = 10151;
    %>
    <hr />
    <pre>
    <%
            Socket mySocket = null;          // socket object
            PrintWriter sockOut = null;      // to send data to the socket
            BufferedReader sockIn = null;    // to receive data from the socket
            try {
                //  #1 add line that creates a client socket
                mySocket = new Socket(serverHost, serverPort);
                // #2 add lines that create input and output streams
                //            attached to the socket you just created
                 sockOut = new PrintWriter(mySocket.getOutputStream(), true);
                 sockIn = new BufferedReader(new InputStreamReader(mySocket.getInputStream()));
            } catch (UnknownHostException e) {
                throw e; // This time the JSP can handle the exception, not us
            } catch (IOException e) {
                throw e; // This time the JSP can handle the exception, not us
    String cdTitle, cdArtist, track1Title, track1Time, track1Rating;
    // Retrieve the HTML form field values
    cdTitle = request.getParameter("cdtitle");
    cdArtist = request.getParameter("cdartist");
    track1Title = request.getParameter("track1title");
    track1Time = request.getParameter("track1time");
    track1Rating = request.getParameter("track1rating");
    // Create a new DOM factory, and from that a new DOM builder object
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    // Note that we are creating a new (empty) document
    Document document = builder.newDocument();
    // The root element of our document wil be <cd>
    // It gets stored as the child node of the whole document (it is the root)
    Element rootElement = document.createElement("cd");
    document.appendChild(rootElement);
    // Create an element for the CD title called <title>
    Element cdTitleElement = document.createElement("title");
    // Add a text code under the <title> element with the value that
    // the user entered into the title field of the web form (cdTitle)
    cdTitleElement.appendChild(document.createTextNode(cdTitle));
    // Place the <title> element underneath the <cd> element in the tree
    rootElement.appendChild(cdTitleElement);
    // Create an <artist> element with the form data, place underneath <cd>
    Element cdArtistElement = document.createElement("artist");
    cdArtistElement.appendChild(document.createTextNode(cdArtist));
    rootElement.appendChild(cdArtistElement);
    // Create a <tracklist> element and place it underneath <cd> in the tree
    // Note that it has no text node associated with it (it not a leaf node)
    Element trackListElement = document.createElement("tracklist");
    rootElement.appendChild(trackListElement);
    // In this example we only have one track, so it is not necessary to
    // use a loop (in fact it is quite silly)
    // But the code below is included to demonstrate how you could loop
    // through and add a set of different tracks one by one if you
    // needed to (although you would need to have the track data already
    // stored in an array or a java.util.Vector or similar
    int numTracks = 1;
    for (int i=0; i<numTracks; i++) {
      String trackNum = Integer.toString(i+1);
      Element trackElement = document.createElement("track");
      trackElement.setAttribute("id", trackNum);
      trackListElement.appendChild(trackElement);
      // Track title element called <title>, placed underneath <track>
      Element trackTitleElement = document.createElement("title");
      trackTitleElement.appendChild(document.createTextNode(track1Title));
      trackElement.appendChild(trackTitleElement);
      // Track time element called <time>, placed underneath <track>
      Element trackTimeElement = document.createElement("time");
      trackTimeElement.appendChild(document.createTextNode(track1Time));
      trackElement.appendChild(trackTimeElement);
      // Track rating element called <rating>, placed underneath <track>
      Element trackRatingElement = document.createElement("rating");
      trackRatingElement.appendChild(document.createTextNode(track1Rating));
      trackElement.appendChild(trackRatingElement);
    OutputFormat format = new OutputFormat();
    format.setIndenting(true);
    // Create a new XMLSerializer that will be used to write out the XML
    // This time we will serialize it to the socket
    // #3 change this line so that it serializes to the socket,
    // not to the "out" object
    XMLSerializer serializer = new XMLSerializer(writer, format);
    serializer.serialize(document);
            // Print out a message to indicate the end of the data, and
            // flush the stream so all the data gets sent now
            sockOut.println("<!--QUIT-->");
            sockOut.flush();
            BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
            String fromServer;
            String fromUser;
             #4 add a while loop that reads text from the
            server socket input stream, line by line, and prints
            it out to the web page, using out.println(...);
            Note that because the reply from the server will contain
            XML, you will need to call upon the toHTMLString() method
            defined below to escape the < and > symbols so that they
            will display correctly in the web browser.
            Also note that as you receive the reply back from the
            server, you should look out for the special <!--QUIT-->
            string that will indicate when there is no more data
            to receive.
            while ((fromServer = sockIn.readLine()) != null) {
            out.println(sockIn.readLine());
                // If the reply from the server said "QUIT", exit from the
                // while loop by using a break statement.
                if (fromServer.equals("QUIT")) {
                    out.println("Connection closed - good bye ...");
                // Print the text from the server out to the user's screen
                out.println("Reply from Server: " + fromServer);
                // Now read a line of text from the keyboard (typed by user)
                fromUser = stdIn.readLine();
                // If it wasn't null, print it out to the screen, and also
                // print a copy of it out to the socket
                if (fromUser != null) {
                    out.println("Client: " + fromUser);
                    sockOut.println(fromUser);
            // Close all the streams we have open, and then close the socket
            sockOut.close();
            sockIn.close();
            mySocket.close();
    %>
    I'm suppose to modify the commented sections labled with #.
    #1,2 are correct but i have doubts on the 3rd and 4th modification.
    for #3 i changed so i serializes to the socket not to the "out" object:
    from
    XMLSerializer serializer = new XMLSerializer(out, format);
    to
    XMLSerializer serializer = new XMLSerializer(writer, format);
    with "out" it prints out some of the results entered but it just hangs i'm thinking it might be the while loop that i added in #4. If i changed it to serialize the socket XMLSerializer serializer = new XMLSerializer(writer, format); it doesn't print out nothing at all; just a blank screen where it hangs.
    I can post the rest of the code (server thats in java and cdinput.html) but since i want to keep my post short and if required i'll post it later on i also omitted some of the code where it creates the DOM textnodes etc to keep my post short.

    On your previous thread, why did you say the server was using http POST and application/xml content type when it quite obviously isn't, but a direct socket communication that abuses XML comments for message end delimiters?
    The comments imply you need to wait for "<!--QUIT-->" on a line by itself, but your loop is waiting for "QUIT".
    Pete

  • Lync Hybrid : Unable to write to active directory due to lack of permission

    Hello everyone,
    I need a little help to troubleshoot a problem I have when moving a user to Lync Online.
    My client has a Dirsync and Adfs working perfectly with o365.
    My problem is that when I try to move a user to Lync Online I have this error :
    Move-CsUser -Identity "Username" -Target sipfed.online.lync.com -credential $cred -hostedmigrationOverrideUrl "https://admin0e.online.lync.com/hostedmigration/hostedmigrationservice.svc"
    "Move-CsUser : Unable to write to Active Directory due to lack of permissions"
    Like the error said, it's a lack of permission but what kind of permission do I need to make this work ? I've tried to googleit/technetit but no helpful topic found...
    Thanks in advance for your help and answers.
    Regards,
    Adrian TUPPER - ABC Systemes - http://thelyncexperience.blog.com/ If answer is helpful, please hit the green arrow on the left, or mark as answer Thank you

    Hi,
    Did you solve the issue by adding the account to RTCUniversalUserAdmins group?
    To move an on-premises user to your Lync Online tenant, run the following cmdlets in the Lync Server Management Shell, using the administrator credentials for your Microsoft Office 365 tenant. Replace "[email protected]" with the information for the user
    that you want to move.
    You can try to move the user from Lync Server on premises to Lync online with the help of the link below “Move users to Lync Online”:
    http://technet.microsoft.com/en-us/library/jj204969.aspx
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

  • Unable to write class

    Hello all,
    I am having problems in creating a chat application.I have my files in c:\something. Now i try to use rmic with the Server program(ie; indirectly implementing Remote ) and it says
    unable to write class: st_stub.class
    unable to write class: st_skel.class
    where st is the name of my classfile
    I compile under c:> by saying
    rmic something.MainClient and this is what gives the error.
    i'am working under Windows98.
    Can anybody please help
    Thanks a lot in advance.

    Hi ,
    Try by using -d option of rmic. let me know the result.
    Anil.
    Developer Technical Support
    Sun Microsystems Inc,
    http://www.sun.com/developers/support

  • Server socket needs to sends images to applet

    Dear expert programmers
    I've got a simple socket server ruuning on my machine which accepts a connection from an applet on an arbitrary port.
    The problem I have is that it needs to "CONSTANTLY" take screenshots of the desktop and send them to the applet so that the applet can load them for people to see. It's a remote desktop project I've been working on for some time now and I have no idea on how to create images and send them using sockets to an applet.
    Could someone please help me - sample code would be appreciated - also efficiency of sending desktop scrrenshots isn't an issue for now.
    Many thanks

    ok, need to know what you have/can get working....
    have you got any working commuincation between Applet and server?
    could you write a method that converts int to 4 bytes?
    and use that to convert int[] to byte[] (4 times as big)?
    for the screen capture part..
    Robot robber=new Robot();
    BufferedImage bi=robber.createScreenCapture(new Rectangle(0,0,screenWidth,screenHeight));
    int[] pixels=bi.getRGB(0,0,screenWidth,screenHeight,null,0,screenWidth);
    byte[] data=toByteArray(pixels);get the outputStream from the connected Socket and use its write(byte[] b) method to send the data
    at the Applet, get the InputStream, use its read(byte[] b) method to get the data
    re-pack to int[] and use setRGB(0,0,screenWidth,screenHeight,int[] data,0,screenWidth)
    get the Graphics Object for the display element of the Applet you want to show the image and use drawImage(BufferedImage,0,0,null) to display

  • Client Server Socket With GUI

    Hi,
    As the name of the forum suggests I am very new to this whole thing.
    I am trying to write a client/server socket program that can encrypt and decrypt and has a GUI, can't use JCE or SSL or any built in encryption tools.
    I have the code for everything cept the encryption part.
    Any help, greatly appreciated,

    tnks a million but how do i incorporate that into the following client and server code:
    here's the client code:
    import java.awt.Color;
    import java.awt.BorderLayout;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    class SocketClient extends JFrame
              implements ActionListener {
    JLabel text, clicked;
    JButton button;
    JPanel panel;
    JTextField textField;
    Socket socket = null;
    PrintWriter out = null;
    BufferedReader in = null;
    SocketClient(){ //Begin Constructor
    text = new JLabel("Text to send over socket:");
    textField = new JTextField(20);
    button = new JButton("Click Me");
    button.addActionListener(this);
    panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.setBackground(Color.white);
    getContentPane().add(panel);
    panel.add("North", text);
    panel.add("Center", textField);
    panel.add("South", button);
    } //End Constructor
    public void actionPerformed(ActionEvent event){
    Object source = event.getSource();
    if(source == button){
    //Send data over socket
    String text = textField.getText();
    out.println(text);
         textField.setText(new String(""));
    //Receive text from server
    try{
         String line = in.readLine();
    System.out.println("Text received :" + line);
    } catch (IOException e){
         System.out.println("Read failed");
         System.exit(1);
    public void listenSocket(){
    //Create socket connection
    try{
    socket = new Socket("HUGHESAN", 4444);
    out = new PrintWriter(socket.getOutputStream(), true);
    in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    } catch (UnknownHostException e) {
    System.out.println("Unknown host: HUGHESAN.eng");
    System.exit(1);
    } catch (IOException e) {
    System.out.println("No I/O");
    System.exit(1);
    public static void main(String[] args){
    SocketClient frame = new SocketClient();
         frame.setTitle("Client Program");
    WindowListener l = new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.addWindowListener(l);
    frame.pack();
    frame.setVisible(true);
         frame.listenSocket();
    SERVER Code
    import java.awt.Color;
    import java.awt.BorderLayout;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    class SocketServer extends JFrame
              implements ActionListener {
    JButton button;
    JLabel label = new JLabel("Text received over socket:");
    JPanel panel;
    JTextArea textArea = new JTextArea();
    ServerSocket server = null;
    Socket client = null;
    BufferedReader in = null;
    PrintWriter out = null;
    String line;
    SocketServer(){ //Begin Constructor
    button = new JButton("Click Me");
    button.addActionListener(this);
    panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.setBackground(Color.white);
    getContentPane().add(panel);
    panel.add("North", label);
    panel.add("Center", textArea);
    panel.add("South", button);
    } //End Constructor
    public void actionPerformed(ActionEvent event) {
    Object source = event.getSource();
    if(source == button){
    textArea.setText(line);
    public void listenSocket(){
    try{
    server = new ServerSocket(4444);
    } catch (IOException e) {
    System.out.println("Could not listen on port 4444");
    System.exit(-1);
    try{
    client = server.accept();
    } catch (IOException e) {
    System.out.println("Accept failed: 4444");
    System.exit(-1);
    try{
    in = new BufferedReader(new InputStreamReader(client.getInputStream()));
    out = new PrintWriter(client.getOutputStream(), true);
    } catch (IOException e) {
    System.out.println("Accept failed: 4444");
    System.exit(-1);
    while(true){
    try{
    line = in.readLine();
    //Send data back to client
    out.println(line);
    } catch (IOException e) {
    System.out.println("Read failed");
    System.exit(-1);
    protected void finalize(){
    //Clean up
    try{
    in.close();
    out.close();
    server.close();
    } catch (IOException e) {
    System.out.println("Could not close.");
    System.exit(-1);
    public static void main(String[] args){
    SocketServer frame = new SocketServer();
         frame.setTitle("Server Program");
    WindowListener l = new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.addWindowListener(l);
    frame.pack();
    frame.setVisible(true);
         frame.listenSocket();
    Again help on this is very welcomed

  • Trying to not wait on a server socket

    Hi!
    I need my code to not sit and pause on an accept command for server sockets, but still continue listening for incoming connections. How do I do this?
    Thanks!

    Depends.. The underlying native APIs usually allow for a variety of options, and therefore so does java..
    - You can set the serversocket to be non-blocked, that is, you call accept and it'll immediately return, with a client socket or without, if you do this inside a loop then the loop can be very hard on your processor as you're 'busy-waiting'.
    - You can set the timeout on the serversocket to a few seconds or so, after which the call will return without a client socket, or it will return before that timeout, with a client socket.
    - You can screw all sockets (and other activities that you're waiting for) inside a poll() or select() like call, which will only return once the state on one of the sockets or events changes, and you can also give this call a timeout value.
    All of these have their pendants in the java language, and I know how, but I'm not going to tell you, as this is the 'Advanced Language Topics' Forum, and not the 'I'm a scipt-kiddie with the need to write yet another server' Forum. I'm not going to do your homework. You should look it up yourself.

  • Error in LSMW Unable to write to file 'C:\ZSIGCO_CP_ZSIG

    Hello,
    In the Step 9  'READ DATA'  I get the Error:  'Unable to write to file 'C:\ZSIGCO_CP_ZSIGCO_CP_ZSIGCO_CP.lsmw.read'
    I do not know what the Problem is and how should I solve this Problem.?
    Can any body help me sort out this Issue..?
    Regards,
    Deepak.

    Thats right the file specification should look like this :-
    ZXX - XX - ZXX Test
    Files
    Legacy Data          On the PC (Frontend)
    Legacy Data          On the R/3 server (application server)
    --   Imported Data        File for Imported Data (Application Server)
    Imported Data                  ZXX_XX_ZXX.lsmw.read
    --   Converted Data       File for Converted Data (Application Server)
    Converted Data                 ZXX_XX_ZXX.lsmw.conv<<<----
    destination file where to write
    Wildcard Value       Value for Wildcard '*' in File Name
    Reagrds
    Dhirendra

  • Unable to write smartlist,  error code 1060301

    Hi Team Members,
    we are trying to use Essbase Studio to create Essbase cube by using relational db tables.
    while doing that we are getting following Error.
    Note:_
    we have tried it with partitioned table & Normal Tables bt result are same.
    rational tables we are using contains varchar2 data type.
    Hirerchy contains : 2 columns SourceID & FileID ---> datatype varchar2
    Measure Hir Contains: 1 column duration ---> datatype varchar2
    Environment:_
    Essbase Studio (11.1.2.1)
    Essbase server 11.1.2.1
    Relational DB: Oracle 10g R2
    eRROR:_
    Specified smart list missing name NoData will be ignored
    Specified smart list out-of-range name OutOfRange will be ignored
    Record #3752 - Unable to write smartlist 4203, error code 1060301*
    Deployment Log_
    Member load for dimension RedPSHIR started at: Sep 22, 2011 12:25:38 PM PKT. Records processed: 2,163.
    Member load for dimension RedPSMHir started at: Sep 22, 2011 12:25:50 PM PKT. Records processed: 3,751. Records rejected: 3. Member load elapsed time: 26 Seconds.
    Data load started at: Sep 22, 2011 12:26:05 PM PKT.     Data load elapsed time: 15 Seconds.
    The error file is located on the server at: C:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseStudio\Server\.\ess_japihome\data\TEST.Plan1_09-22-11_12-25-36.err
    Failed to deploy Essbase cube.
    Caused by: Failed to load data into database: Plan1.
    Caused by: Cannot get async process state. Essbase Error(1042017): Network error: The client or server timed out waiting to receive data using TCP/IP. Check network connections. Increase the olap.server.netConnectRetry and/or olap.server.netDelay values in the essbase.properties. Restart the server and try again.
    TEST.Plan1_09-22-11_12-25-36.err file output_
    Specified smart list missing name NoData will be ignored
    Specified smart list out-of-range name OutOfRange will be ignored
    Record #3752 - Unable to write smartlist 4203, error code 1060301
    Regards,
    Alee

    Hi guys,
    I think the issue was due to using varchar2 datatype column (duration) for measure Hirerchy.
    after converting it into number (using view option in rational DB) & doing the whole process again. it works fine
    Reference section (Note):
    rational tables we are using contains varchar2 data type.
    Hirerchy contains : 2 columns SourceID & FileID ---> datatype varchar2
    Measure Hir Contains: 1 column duration ---> datatype varchar2
    Regards,
    Alee

Maybe you are looking for

  • IPod touch is not working with iTunes

    My iPod touch is no longer recognized by my iTunes even though it has been recognized without problems ever since I bought it. My computer has never crashed, had a virus or any problems at all. Because iTunes didn't recognize it, I was given the opti

  • HR ABAP:  table/infotype relationships

    Hi. I'm experienced in doing ABAP programming for all the rest of the modules, but with ABAP HR, I am new and doing one for the first time.  I need your help regarding how to find tables/infotypes and relationships to each other. Specific work exampl

  • Use iPhone as wireless keyboard???

    Hy everyone, I have now searched both iTunes app Store and the iPhone forum and the web and can't find anything that would turn the iPhone into a wireless keyboard for your Mac. Have I missed something? Does anyone know if such an app exist? I don't

  • Cloud 12c schedule patch plan?

    Am I missing something obvious? Can't seem to figure out how to schedule the deployment of an analyzed Patch Plan in Cloud 12cR2 - only seem to have the option to deploy immediately. I seem to recall being able to scheduled patches in previous db con

  • Audio stopped working (Macbook Pro)

    The audio stopped working/I cannot adjust it at all. I googled and I've done a PRAM reset, I have no red light coming from the jack, and when I go to 'sound' via preferences it tells me that there are no output or input devices found. Help would be g