Getting continious stream  in one socket connection

i want to make one socket connection with client and when client send more than one packet ( it can be continious or after some time - in byte stream) how i will be able to get those packet in interwal.
please suggest

then maybe you can help me out ejp
***server side****
buffer.clear();
buffer.put("return string".getBytes());
buffer.flip();
while (buffer.hasRemaining())
    socketChannel.write(b);
***client side****
int line;
byte[] mybyte=new byte[1024];
while ((line=in.read(mybyte,0,mybyte.length))!=-1)
         System.out.write(mybyte,0,line);
System.out.println("write finished");these are code snippets frm a client server prog i have.
if i just do with the single while loop, my client will see the full return msg, but not the write finish output. its always waiting for the -1 eos.
now, if i use what i said earlier, it works fine. could you kindly help me with this problem?

Similar Messages

  • Multiple input stream in one socket connection

    Can we have multiple input streams for a java socket connection? It means that in a client/server application (creates using java socket), can we have multiple input streams for the client side program. For example, the input streams are to cater for the need of letting the user to chat and downloading some files from the chat partner at the same time. And do we need to use thread to create the multiple input streams like the case when we create a multithreaded server? Anyone out there who knows the solution please post it. Thanks in advance.

    Can we have multiple input streams for a java socket
    connection? It means that in a client/server
    application (creates using java socket), can we have
    multiple input streams for the client side program.
    For example, the input streams are to cater for the
    need of letting the user to chat and downloading some
    files from the chat partner at the same time. And do
    we need to use thread to create the multiple input
    streams like the case when we create a multithreaded
    server? Anyone out there who knows the solution please
    post it. Thanks in advance.Ok im no expert here but this is what i learned:
    a Socket can have only one InputStream (Socket.getInputStream()) and one OutputStream Socket.getOutputStream()). So you will have to create a way to make multiple Socket connections in your client program. And yes, you have to use threads for your server. if you dont the client will have to wait until the user before them is finished with the connection before being able to connect. I hope this helps you out. BTW please check out http://www.javabible.com. they have the book online now for free.
    Joeyford1

  • JPanel doesn't get visible when followed by socket connection

    Hi all... I'm having a problem with a java Swing application...
    when a actionEven is given, I want to create a new socket to connect to a server, and I'd like to show a panel with a "connecting... " message while it's done.
    My problem is that writing the code secuentially, it does not work in the correct order
    public void actionPerformed(ActionEvent e) {
                     - JPanel.setVisible(true);
                     - JPanel.repaint();
                     - socket connection code here
    }this, makes the socket connection and displays the panel once it's done. Why this behaviour?
    I have also tried to not to change the visible property in the event handler, but creating a new Thread when it's triggered, and giving it maximum priority... but this doesn't work neither.
    Thank you

    thank you camickr,
    I tried the opposite of what I did at first... creating a new thread with minimum priority and doing the socket connection in it, and it worked.

  • Server/Client Socket Connection

    Hi, I am trying to program a simple server/client socket connection program, the main function is to send and receive objects between them. I somehow went wrong and the connection between them keeps terminating right after establishing connection. Is there anything I can do to resolve this?
    This is gonnna be kinda long post.. sorry. These are the code that starts and ends the socket connection. I'm kinda desperate for this to work.. so thanks in advance.
    appinterface.java:
    //Set up server to receive communications; process connections. 1x.
         public void runServer () {
              try {
                   //Create a ServerSocket
                   server = new ServerSocket(12345, 100);
                   try {
                             waitForSockConnection();     //Wait for a connection.
                             getSockStreams();               //Get input & output streams.
                             establishDbConnection();     //Open up connection to DB.
                   finally {
                             closeSockConnection(); //Close connection.
              //Process problems with I/O
              catch(IOException ioException) {
                   displayMessage("I/O Error: " + ioException);
                   runServer();
         //Wait for connection to arrive, then display connection info
         private void waitForSockConnection() throws IOException {
              displayMessage("Waiting for connection");
              connection = server.accept(); //Allow server to accept connection.
              displayMessage("Connection received from: " + connection.getInetAddress().getHostName());
         //Get streams to send and receive data.
         private void getSockStreams() throws IOException {
              //Set up output streams for objects
              ObjectOutputStream output = new ObjectOutputStream(connection.getOutputStream());
              output.flush(); //Flush output buffer to send header information.
              //Set up input stream for objects.
              ObjectInputStream input = new ObjectInputStream(connection.getInputStream());
              try {
              classHolderServer holderObj = new classHolderServer();
              holderObj = (classHolderServer)input.readObject();
              processSockConnection(holderObj);
              displayMessage("Got I/O Streams");
              //Catch problems reading from client
              catch (ClassNotFoundException classNotFoundException) {
                             displayMessage("Unknown object type received");
         //Process connection with client.
         private void processSockConnection(classHolderServer holderObj) throws IOException {
              //sendMessage("Connection Successful");
                        //True is query, and false is auth.
                        if(holderObj.type1==true)
                             processDbStatement(holderObj.type2, holderObj.sqlquery);
                        else {
                             authCheck(holderObj.userName, holderObj.passWord);
                             if(!authCheck)
                             closeDbConnection();
         //Send messages to client.
         private void sendMessage(String message) {
              // Send message to client
              try {
                   ObjectOutputStream output = new ObjectOutputStream(connection.getOutputStream());
                   output.flush();
                   output.writeObject(message);
                   output.flush();
                   displayMessage("Message Sent:" + message);
              catch (IOException ioException) {
                   displayMessage("\nError Sending Message: " + message);
         //Send object to client
         private void sendObject(Object holderObj) {
                   // Send object to client
                   try {
                        ObjectOutputStream output = new ObjectOutputStream(connection.getOutputStream());
                        output.writeObject(holderObj);
                        output.flush();
                        displayMessage("\nObject sent");
                   //Process problems sending object
                   catch (IOException ioException) {
                        displayMessage("\nError writing object");
         //Close streams and socket.
         private void closeSockConnection() {
                   displayMessage("Terminating connection");
                   try {
                        //output.close();
                        //input.close();
                        connection.close();
                        closeDbConnection();
                        this.userName = null;
                        this.passWord = null;
                        this.receiverId = 0;
                        this.authCheck = false;
                   catch (IOException ioException) {
                        displayMessage("I/O Error: " + ioException);
              }Client:
    private void runClient() {
              //Connect to sever and process messages from server.
              try{
                   connectToServer();
                   getStreams();
                   processConnection();
              //Server closed connection.
              catch(EOFException eofException) {
                   //displayMessage"Client Terminated Connection");
              //Process problems communicating with server.
              catch (IOException ioException) {
                   //displayMessage"Communication Problem");
              finally {
                   closeConnection();
         //Connect to server
         private void connectToServer() throws IOException {
              //displayMessage("Attempting connection\n");
              //Create Socket to make connection to sever.
              client = new Socket(InetAddress.getByName(chatServer), 12345);
              //Display connection information
              //displayMessage("Connected to: " + client.getInetAddress().getHostName());
         //Get streams to send and receive data.
         private void getStreams() throws IOException {
              //Set up output stream for objects.
              ObjectOutputStream output = new ObjectOutputStream(client.getOutputStream());
              output.flush(); //Flush outout buffer to send header information.
              //Set up input stream for objects.
              ObjectInputStream input = new ObjectInputStream(client.getInputStream());
              //displayMessage("\nGot I/O streams\n");
         //Close socket connection.
         private void closeConnection() {
              //displayMessage("\nClosing connection");
              try {
                   ObjectOutputStream output = new ObjectOutputStream(client.getOutputStream());
                   output.close();
                   ObjectInputStream input = new ObjectInputStream(client.getInputStream());
                   input.close();
                   client.close();
                   authCheck=false;
              catch(IOException ioException) {
                   ioException.printStackTrace();
         //Send data to server.
         private void sendObject(classHolderClient queryObj) {
              try {
                   output.writeObject(queryObj);
                   output.flush();
                   //displayMessage("Please wait..");
              //Process problems sending object.
              catch (IOException ioException) {
                   //displayMessage("\nError writing object");
         //Process connection with server.
         private void processConnection() throws IOException {
              try{
                   classHolderClient holderObj = new classHolderClient();
                   holderObj = (classHolderClient)input.readObject();
                   if(holderObj.type2==2) {
                             this.authCheck=holderObj.authCheck;
                             this.userName=holderObj.userName;
                             this.passWord=holderObj.passWord;
              catch(ClassNotFoundException classNotFoundException) {
                   //displayMessage(classNotFoundException);
              }

    private ObjectOutputStream output = new ObjectOutputStream(client.getOutputStream());Like this? But this will cause an error asking me to catch an exception:
    C:\Documents and Settings\Moon\My Documents\Navi Projects\School\OOPJ Project\Prototype\GPS-Lite v2 Alpha Debugger\client.java:41: unreported exception java.io.IOException; must be caught or declared to be thrown
            private ObjectOutputStream output = new ObjectOutputStream(client.getOutputStream());
                                                                                             ^
    C:\Documents and Settings\Moon\My Documents\Navi Projects\School\OOPJ Project\Prototype\GPS-Lite v2 Alpha Debugger\client.java:41: unreported exception java.io.IOException; must be caught or declared to be thrown
            private ObjectOutputStream output = new ObjectOutputStream(client.getOutputStream());
                                                ^
    2 errors

  • Error Making Socket Connection

    So, I'm trying to figure this out, I get this error after my code has compiled(Metrowerks CodeWarrior),the little dos run window comes up and afterwards I get this message "Error making socket connection". Anyone ever seen this? I'm running Windows 2000, CodeWarrior 5.0. Any ideas? Thanks

    I've seen it when ive had an error making the socket connection!
    Of course it was easier to fix my problem because I could see the code
    and didnt have to guess it.

  • How can you use multiple stream types with one socket?

    Hi,
    I'm working on a large program that currently uses Object Input/Output streams for all of the messaging in a client/server application. This works fine except when files need to be transferred. In many cases using a Object stream to send a file can be 30 times slower than using a Buffered input/output stream. I've found I can combined the two. Here are some code snippets to give you a basic idea of what's happening...
    BufferedInputStream bis = new BufferedInputStream( serverSocket.getInputStream( ) );
    ObjectInputStream ois = new ObjectInputStream( serverSocket.getInputStream( ) );
    //this code runs on a thread on the server
    while( true ){
    switch( whichKindOfStreamUsedNext ){
    case OBJECT_STREAM:
    Object object = ois.readObject( );
    doSomethingWithObject( object );
    break;
    case BUFFERED_STREAM:
    readFromBuffer( bis );
    break;
    Obviously there is a lot missing here. Basically the variable whichKindOfStreamUsedNext is changed in the methods doSomethingWithObject( ) and readFromBuffer depending on what the current state of the server is and what is passed to these methods from the client.
    Here is the problem. If readFromBuffer( ) does a very small task and the client sends an object through an object stream everything is okay. I've switched whichKindOfStreamUsedNext = OBJECT_STREAM before that point and by the time the client sends the object the server is waiting on Object object = ois.readObject( );. However if the method readFromBuffer( ) does a very time intensive task and it takes a while to return and meanwhile the client sends an object then the server never gets that object. Does anyone have an easy solution to this problem. (Changing the whole program to just using BufferedStreams is not a solution).
    Thanks.

    Thanks a lot for the response.
    I guess I didn't realize I could do that.
    I changed how I am doing the program anyways. Sending flags to switch streams was a little messy. but now I have a new problem. I've discovered that mixing object streams with buffered streams also leads to significant speed increases. I do that in this manner...
    int ONE_MEG = 1024*1024;
    ObjectInputStream ois = new ObjectInputStream( new BufferedInputStream( socket.getInputStream( ), ONE_MEG ) );
    and I do the same thing for the ObjectOutputStream. It works very well when I just set up the client's output stream and the servers input stream in this manner. Upload times are increased from 60 seconds to 2-5 seconds.
    Unfortunately when I try to do the same thing with the servers output stream and the clients input stream to speed up downloads I get deadlock! As soon as the socket connection is opened and I try to set up the streams in this manner I get deadlock. Does anyone have any idea why this occurs and what I can do to fix it?

  • Get multiple Input/Output Stream from same socket ?

    For a better express of my problem i will put my test example
    I have those 4 classes
    package test;
    import...
    public class ReaderExecutor extends Thread{
            private InputStream in = null;
            private static int defaultID = 0;
            private int ID = getID();
            public ReaderExecutor(InputStream in){
                this.in = in;
            public void run(){
                try {
                    int c ;
                    while ((c=in.read())!=-1)
                        System.out.println("ReaderThread " + this.ID + ":" + c);
                catch (IOException e) {
                    System.out.println("ReaderThread "+this.ID+" stopped !");
            private static int getID(){
                return defaultID++;
    package test;
    import...
    public class WriterExecuter extends Thread{
        OutputStream out = null;
        private static boolean odd = true;
        private boolean isOdd ;
        public WriterExecuter(OutputStream out) {
            this.out = out;
            isOdd = odd;
            odd = !odd;
        public void run(){
            try{
                for (int i = isOdd?1:2;i<10;i+=2){
                    System.err.println(i);
                    out.write(i);
            }catch(Exception e){
                System.out.println("WriterThread stopped !");
    package test;
    import...
    public class Main { 
        public Main() {
        public static void main(String[] args) throws Exception {
            try{
                ServerSocket ss = new ServerSocket(9090);
                System.out.println("Ascult ... ");
                Socket client = ss.accept();
                new ReaderExecutor(client.getInputStream()).start();
                //Thread.sleep(2000);
                new ReaderExecutor(client.getInputStream()).start();
            }catch (Exception e){
                e.printStackTrace();
    package test;
    import...
    public class Main1 {
        public Main1() {
        public static void main(String[] args) {
            try{
                Socket s = new Socket("localhost",9090);
                WriterExecuter t= null ;
                t = new WriterExecuter(s.getOutputStream());
                t.start();
                t = new WriterExecuter(s.getOutputStream());
                t.start();
            }catch(Exception e){
                e.printStackTrace();
    }Now if i run successive Main , Main1 i get this output
    Ascult ...
    ReaderThread 0:0
    ReaderThread 1:0
    ReaderThread 0:0
    ReaderThread 1:0
    ReaderThread 0:0
    ReaderThread 1:0
    ReaderThread 0:0
    ReaderThread 1:0
    ReaderThread 0:0
    ReaderThread 0 stopped !
    ReaderThread 1 stopped !The question is can i get other Input/Output individual streams with a separate logic functionality from the same socket?
    From this example it seems i can't :(
    Thx
    Alex

    For what you are trying to do the simplest solution is to have one socket per "stream" that is the way they are designed to be used.
    However, you can multiplex multiple stream over a single socket, but you have do the coding yourself or use a solution which does this for you e.g. JMS. (There is no support at the socket level for this)

  • I need to connect my iPad to a projector and USB ports. What do I need to do this and where can I get the suitable fittings? I really need to have more than one USB connection port. Help

    I need to connect my iPad to a projector and have USB ports. What do I need to do this and where can I get the suitable fittings? I really need to have more than one USB connection port. Help

    You can connect via a cable or wireless using an Apple TV.
    http://ipad.about.com/od/iPad_Guide/a/How-To-Connect-Your-Ipad-To-Your-Tv.htm
    Connect an iPad to a Television or Projector
    http://www.everymac.com/systems/apple/ipad/ipad-faq/how-to-connect-ipad-to-tv-te levision-projector.html
    Connecting iPad iPhone or iPod to TV or Projector
    http://www.disabled-world.com/assistivedevices/computer/ipad-tv.php
    iPad Accessories: Connections for a TV or Projector
    http://www.dummies.com/how-to/content/ipad-accessories-connections-for-a-tv-or-p rojector.html
    You may be interested in AirPlay on the Apple TV:
    http://www.apple.com/airplay/
    Alternately, there are Apple Digital AV Adapters for hardwired connections:
    http://support.apple.com/kb/ht4108
    If your location does’t have wifi to use with the Apple TV, use a portable router.
    Portable routers http://compnetworking.about.com/od/routers/tp/travel_routers.htm
     Cheers, Tom

  • TCP Socket connection in CLOSE_WAIT status and not getting closed

    I am facing an issue with the TCP socket connections not getting closed and they are in CLOSE_WAIT status for ever.
    As a part of batch process in our application, emails are sent with 4 embedded images. These images are downloaded from 3rd party site with IP say "UUU.XXX.YYY.ZZZ"
    The images are embedded to email as follows
    1. An URL object is created with the site url.
    URL urlPhoto = new
    URL("http://UUU.XXX.YYY.ZZZ/email/photos.jpg");
    2.     The image cid is created with the URL object and the image name
    HtmlEmail htmlEmail = new HtmlEmail();
    String cid1 = htmlEmail.embed(urlPhoto,
    "photo.jpg");
    3.     The image cid is added to the email template by replacing the ${cid1} and the email is sent.
    <td valign="top">
                   <img src="cid:${cid1}" width="279" height="274">
              </td>
    When a mail is sent, 4 new TCP connections are opened and are put in CLOSE_WAIT status for ever. For every mail sent 4 new connections are opened. In UNIX there is an upper limit on the number of open file handles (defaults to 1024) at any point of time. The open TCP connection has the underlying socket in CLOSE_WAIT status and is not getting closed at all. When the upper limit (1024) is reached the batch process is throwing the following exception and terminates.
    Caused by: com.inet.tds.ap: java.net.SocketExceptionjava.net.SocketException: Too many open files
    at com.inet.tds.am.a(Unknown Source)
    at com.inet.tds.TdsDriver.a(Unknown Source)
    at com.inet.tds.TdsDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at com.hcomemea.batchprocess.dataaccess.database.BaseJdbcDao.openConnection(BaseJdbcDao.java:106)
    ... 12 more
    When I run the command lsof in UNIX which list the open file handles in the system
    $ /usr/sbin/lsof -p 22933 -i | grep CLOSE_WAIT
    java 22933 build_master 297u IPv6 129841943 TCP integration.com:47929->UUU.XXX.YYY.ZZZ:http (CLOSE_WAIT)
    java 22933 build_master 298u IPv6 129841947 TCP integration.com:47933->UUU.XXX.YYY.ZZZ:http (CLOSE_WAIT)
    java 22933 build_master 299u IPv6 129841950 TCP integration.com:47936->UUU.XXX.YYY.ZZZ:http (CLOSE_WAIT)
    java 22933 build_master 300u IPv6 129841970 TCP integration.com:47952->UUU.XXX.YYY.ZZZ:http (CLOSE_WAIT)
    ���list of 935 connections similarly�
    I tried 2 solutions
    1. Got the HttpURLConnection from the URL object and invoked disconnect method on the same. But it doesn�t work.
    2. Ran the batch process java program with the parameter �Dhttp.keepAlive=false to close the underlying connection but didn�t help.
    I need the underlying sockets to be closed and not put in CLOSE_WAIT status after sending the mail.
    Is it the problem with the embed method of HtmlEmail object not closing the underlying socket connection.
    If anyone has faced this issue before, kindly let me know the possible solutions for the same ASAP.
    Thank you,
    Ramesh G

    This sounds more like a problem due to connection pooling at middle tier/application server.
    If that has been ruled out, then you might to enable DCD or set expiry time on the server.

  • MDEX intermittantly not returning response, getting com.endeca.navigation.ENEConnectionException: Error reading from socket connection buffer.Connection reset

    Intermittant issue where certain portlets have the spinning wheel and error getting thrown in the log, and resulting in stuck threads, has anyone seen this?
    Caused by: com.endeca.navigation.ENEConnectionException: Error reading from socket connection buffer.Connection reset
            at com.endeca.navigation.OptiInputBuffer.read(Unknown Source)
            at com.endeca.navigation.OptiInputBuffer.readFully(Unknown Source)
            at com.endeca.navigation.OptiInputBuffer.readUInt(Unknown Source)
            at com.endeca.navigation.OptiInputBuffer.readLine(Unknown Source)
            at com.endeca.navigation.OptiBinaryInterp.FormatCat(Unknown Source)
            at com.endeca.navigation.OptiBinaryInterp.FormatCatsWithAncs(Unknown Source)
            at com.endeca.navigation.OptiBinaryInterp.FormatCatGroup(Unknown Source)
            at com.endeca.navigation.OptiBinaryInterp.FormatBin(Unknown Source)
            at com.endeca.navigation.OptiBinaryInterp.FormatBinList(Unknown Source)
            at com.endeca.navigation.OptiBinaryInterp.ParseBinaryNode(Unknown Source)
            at com.endeca.navigation.OptiBackend.getNavigation(Unknown Source)
            at com.endeca.navigation.HttpENEConnection.query(Unknown Source)
            at com.endeca.portal.mdex.MDEXUtil.execute(MDEXUtil.java:433)
            at com.endeca.portal.data.DataSource.execute(DataSource.java:546)

    Message appears in logs internmittantly during page rendering which has Breadcrumbs, Results Table, Guided Navigation portlets.  There are Agraphs in front of several Dgraphs.

  • I suppose it is the problem with socket connection,Please help

    Hi,
    I'm trying to build a chat server in Java on Linux OS.I've created basically 2 classes in the client program.The first one shows the login window.When we enter the Login ID & password & click on the ok button,the data is sent to the server for verification.If the login is true,the second class is invoked,which displays the messenger window.This class again access the server
    for collecting the IDs of the online persons.But this statement which reads from the server causes an exception in the program.If we invoke the second class independently(ie not from 1st class) then there is no problem & the required data is read from the server.Can anyone please help me in getting this program right.I'm working on a p4 machine with JDK1.4.
    The Exceptions caused are given below
    java.net.SocketException: Connection reset by peer: Connection reset by peer
    at java.net.SocketInputStream.SocketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:119)
         at java.io.InputStreamReader$CharsetFiller.readBytes(InputStreanReader.java :339)
         at java.io.InputStreamReader$CharsetFiller.fill(InputStreamReader.java:374)
         at java.io.InputStreamReader.read(InputStreamReader.java:511)
         at java.io.BufferedReader.fill(BufferedReader.java:139)
         at java.io.BufferedReader.readLine(BufferedReader.java:299)
         at java.io.BufferedReader.readLine(BufferedReader.java:362)
         at Login.LoginData(Login.java:330)
         at Login.test(Login.java:155)
         at Login$Buttonhandler.actionPerformed(Login.java:138)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1722)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:17775)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4141)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:253)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:261)
         at java.awt.Component.processMouseEvent(Component.java:4906)
         at java.awt.Component.processEvent(component.java:4732)
         at java.awt.Container.processEvent(Container.java:1337)
         at java.awt.component.dispatchEventImpl(Component.java:3476)
         at java.awt.Container.dispatchEventImpl(Container.java:1399)
         at java.awt.Component.dispatchEvent(Component.java:3343)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3302)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3014)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2967)
         at java.awt.Container.dispatchEventImpl(Container.java:1373)
         at java.awt.window.dispatchEventImpl(Window.java:1459)
         at java.awt.Component.dispatchEvent(Component.java:3343)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:439)
         at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:131)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
         My program looks somewhat like this :
    1st class definition:
    public class Login extends Jframe// Login is the name of the first class;
    Socket connection;
    DataOutputStream outStream;
    BufferedReader inStream;
    Frame is set up here
    public class Buttonhandler implements ActionListener
    public void actionPerformed(ActionEvent e) {
    String comm = e.getActionCommand();
    if(comm.equals("ok")) {
    check=LoginCheck(ID,paswd);
    test();
    public void test() //checks whether the login is true
    if(check)
    new Messenger(ID);// the second class is invoked
    public boolean LoginCheck(String user,String passwd)
    //Enter the Server's IP & port below
    String destination="localhost";
    int port=1234;
    try
    connection=new Socket(destination,port);
    }catch (UnknownHostException ex){
    error("Unknown host");
    catch (IOException ex){
    ex.printStackTrace ();
    error("IO error creating socket ");
    try{
    inStream = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    outStream=new DataOutputStream(connection.getOutputStream());
    }catch (IOException ex){
    error("IO error getting streams");
    ex.printStackTrace();
    System.out.println("connected to "+destination+" at port "+port+".");
    BufferedReader keyboardInput=new BufferedReader(new InputStreamReader(System.in));
    String receive=new String();
    try{
    receive=inStream.readLine();
    }catch(IOException ex){ error("Error reading from server");}
    if(receive.equals("Logintrue"))
    check=true;
    else
    check=false;
    try{
    inStream.close();
    outStream.close();
    connection.close();
    }catch (IOException ex){
    error("IO error closing socket");
    return(check);
    // second class is defined below
    public class Messenger
    Socket connect;
    DataOutputStream outStr;
    BufferedReader inStr;
    public static void main(String args[])
    { Messenger mes = new Messenger(args[0]);}
    Messenger(String strg)
    CreateWindow();
    setupEvents();
    LoginData(strg);
    fram.show();
    void setupEvents()
    fram.addWindowListener(new WindowHandler());
    login.addActionListener(new MenuItemHandler());
    quit.addActionListener(new MenuItemHandler());
    button.addActionListener(new Buttonhandle());
    public void LoginData(String name)
    //Enter the Server's IP & port below
    String dest="localhost";
    int port=1234;
    int r=0;
    String str[]=new String[40];
    try
    connect=new Socket(dest,port);
    }catch (UnknownHostException ex){
    error("Unknown host");
    catch (IOException ex){
    ex.printStackTrace ();
    error("IO error creating socket ");
    try{
    inStr = new BufferedReader(new InputStreamReader(connect.getInputStream()));
    outStr=new DataOutputStream(connect.getOutputStream());
    }catch (IOException ex){
    error("IO error getting streams");
    ex.printStackTrace();
    String codeln=new String("\n");
    try{
    outStr.flush();
    outStr.writeBytes("!@*&!@#$%^");//code for sending logged in users
    outStr.writeBytes(codeln);
    outStr.write(13);
    outStr.flush();
    String check="qkpltx";
    String receive=new String();
    try{
    while((receive=inStr.readLine())!=null) //the statement that causes the exception
    if(receive.equals(check))
    break;
    else
         str[r]=receive;
         r++;
    }catch(IOException ex){ex.printStackTrace();error("Error reading from socket");}
    catch(NullPointerException ex){ex.printStackTrace();}
    } catch (IOException ex){ex.printStackTrace();
    error("Error reading from keyboard or socket ");
    try{
    inStr.close();
    outStr.close();
    connect.close();
    }catch (IOException ex){
    error("IO error closing socket");
    for(int l=0,k=1;l<r;l=l+2,k++)
    if(!(str[l].equals(name)))
    stud[k]=" "+str[l];
    else
    k--;
    public class Buttonhandle implements ActionListener
    public void actionPerformed(ActionEvent e) {
    //chat with the selected user;
    public class MenuItemHandler implements ActionListener
    public void actionPerformed(ActionEvent e)
    String cmd=e.getActionCommand();
    if(cmd.equals("Disconnect"))
    //Disconnect from the server
    else if(cmd.equals("Change User"))
         //Disconnect from the server & call the login window
    else if(cmd.equals("View Connection Details"))
    //show connection details;
    public class WindowHandler extends WindowAdapter
    public void windowClosing(WindowEvent e){
    //Disconnect from server & then exit;
    System.exit(0);}
    I�ll be very thankful if anyone corrects the mistake for me.Please help.

    You're connecting to the server twice. After you've successfully logged in, pass the Socket to the Messenger class.
    public class Messenger {
        Socket connect;
        public static void main(String args[]) {
            Messenger mes = new Messenger(args[0]);
        Messenger(Socket s, String strg) {
            this.connect = s;
            CreateWindow();
            setupEvents();
            LoginData(strg);
            fram.show();
    }

  • How can i reuse my existing socket connection

    Hi,
    this might sound basic, it probably is:
    As part of my larger project, i have to send and recieve data to multiple socket connections.
    The thing that happens is that everytime i send data, it seems that java is creating a new stream or something (code is multithreaded)
    so as i send 4 items of data, a bit like a chat program sending 4 statements, it creates 4 different streams, instead of using the same stream. therefore when i close the connection, i get:
    java.net.SocketException: Connection reset 4 times.
    i know why.. its because i have added the:
    Socket socket=new Socket(host, port);
    BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
    bit in the same method with the
    out.println(THE DATA....);
    out.flush();
    The thing what i want to do is to create the connection one, and reuse the objects:
    out, in and socket
    to send / recieve the new data.
    please help me guys,
    thanks

    All the threads would be able to get the same reference to....
    class SocketWrapper {
         private final Object readLock = new Object();
         private final Object writeLock = new Object();
         // client side
        public SocketWrapper(String hostname, int port);
         // server side.
        public SocketWrapper(Socket);
         // send data
         public void send(Serializable object) throws IOException;
         // receive data. synchronized(writeLock);
         public Serializable getNext() throws IOException;
         // create a new socket as required, throw IllegalState if server side. synchronized(readLock)
         private void createNewSocket() throws IllegalStateException;
    }The send autoconnects as required. It then send on message/packet/object.
    The getNext autoconnects as required. It reads one message/packet/object and returns.
    This allows multiple threads to access the same socket. It allows data to be sent while a thread is blocking on a read. (Thus two locks)

  • Getting an error, Unable to properly connect to the workflow service while attaching workflow to the list manually

    Hello Experts,
    I am facing an issue on test server while attaching workflow manually to the list. 
    On dev environment I am deploying workflow through visual studio and here everything works fine.
    Please suggest if anyone has faced this issue earlier.
    Regards,
    Uday G
    Line 3874: 04/27/2015 02:02:15.72 w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Logging Correlation Data      
    xmnv Medium  
    Name=Request (POST:http://spwfte800-001:80/_layouts/15/AssocWrkfl.aspx?AssociatedList=0b6b6303-d8ac-4007-94d0-5cf5502df0f6&WF4=1)
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3875: 04/27/2015 02:02:15.73
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Authentication Authorization  
    agb9s Medium  
    Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|usykgw\sp_farm_te, ClaimsCount=30
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3876: 04/27/2015 02:02:15.73
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Logging Correlation Data      
    xmnv Medium  
    Site=/ 9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3877: 04/27/2015 02:02:15.80
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Database                      
    ahjqp High    
    [Forced due to logging gap, cached @ 04/27/2015 02:02:15.78, Original Level: Verbose] SQL connection time: 0.093 for Data Source=SPDBTE800-001\MYNET_SQL;Initial Catalog=WSS_Content_80;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max
    Pool Size=100;Connect Timeout=15;Application Name=SharePoint[w3wp][2][WSS_Content_80]
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3878: 04/27/2015 02:02:15.80
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    UserAgent not available, file operations may not be optimized.    at Microsoft.SharePoint.SPFileStreamManager.CreateCobaltStreamContainer(SPFileStreamStore spfs, ILockBytes ilb, Boolean copyOnFirstWrite, Boolean disposeIlb)     at
    Microsoft.SharePoint.SPFileStreamManager.SetInputLockBytes(SPFileInfo& fileInfo, SqlSession session, PrefetchResult prefetchResult)     at Microsoft.SharePoint.CoordinatedStreamBuffer.SPCoordinatedStreamBufferFactory.CreateFromDocumentRowset(Guid
    databaseId, SqlSession session, SPFileStreamManager spfstm, Object[] metadataRow, SPRowset contentRowset, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres)     at Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd,
    Object ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3879: 04/27/2015 02:02:15.80*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    ...)     at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Byte bMainFileRequest, Boolean&
    pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion,
    String& pbstrTimeLastModified, String& pbstrContent, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId,
    Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, ...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3880: 04/27/2015 02:02:15.80*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    ...Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder, Guid& pgDocScopeId)     at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndMetaInfo(String
    bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Byte bMainFileRequest, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean&
    pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, UInt32& pdwPartCount, Object&
    pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbst...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3881: 04/27/2015 02:02:15.80*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    ...rRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32&
    pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder, Guid& pgDocScopeId)     at Microsoft.SharePoint.Library.SPRequest.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte
    bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Byte bMainFileRequest, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument,
    Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion,...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3882: 04/27/2015 02:02:15.80*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    ... String& pbstrTimeLastModified, String& pbstrContent, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32&
    pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl,
    String& pbstrContentTypeOrder, Guid& pgDocScopeId)     at Microsoft.SharePoint.SPWeb.GetWebPartPageContent(Uri pageUrl, Int32 pageVersion, PageView requestedView, HttpContext context, Boolean forRender, Boolean includeHidden, Boolean mainFileRequest,
    Boolean fetchDependencyInformation, Boolean& ghostedPage, String& siteRoot, Guid& siteId, Int64& bytes, ...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3883: 04/27/2015 02:02:15.80*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    ...Guid& docId, UInt32& docVersion, String& timeLastModified, Byte& level, Object& buildDependencySetData, UInt32& dependencyCount, Object& buildDependencies, SPWebPartCollectionInitialState& initialState, Object&
    oMultipleMeetingDoclibRootFolders, String& redirectUrl, Boolean& ObjectIsList, Guid& listId)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.FetchWebPartPageInformationForInit(HttpContext context, SPWeb spweb, Boolean
    mainFileRequest, String path, Boolean impersonate, Boolean& isAppWeb, Boolean& fGhostedPage, Guid& docId, UInt32& docVersion, String& timeLastModified, SPFileLevel& spLevel, String& masterPageUrl, String& customMasterPageUrl,
    String& webUrl, String& siteUrl, Guid& siteId, Object& buildDependencySetData, SPWebPartCollectionInitialState& initialState, ...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3884: 04/27/2015 02:02:15.80*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    ...String& siteRoot, String& redirectUrl, Object& oMultipleMeetingDoclibRootFolders, Boolean& objectIsList, Guid& listId, Int64& bytes)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.GetWebPartPageData(HttpContext
    context, String path, Boolean throwIfFileNotFound)     at Microsoft.SharePoint.ApplicationRuntime.SPVirtualPathProvider.GetCacheKey(String virtualPath)     at System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(VirtualPath
    virtualPath, Boolean ensureIsUpToDate)     at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
        at System.Web.Compilation.BuildManager.GetVPathBuildResultWithN...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3885: 04/27/2015 02:02:15.80*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    ...oAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)     at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext
    context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)     at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile,
    IDictionary contentTemplateCollection)     at System.Web.UI.Page.ApplyMasterPage()     at System.Web.UI.Page.PerformPreInit()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
        at System.Web.UI.Page.ProcessRequest(Boolean in...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3886: 04/27/2015 02:02:15.80*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    ...cludeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
        at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext
    context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer,
    IntPtr nativeReque... 9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3887: 04/27/2015 02:02:15.80*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    ak8dj High    
    ...stContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr
    pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr
    rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3888: 04/27/2015 02:02:15.80
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Files                        
    aiv4w Medium  
    Spent 0 ms to bind 44035 byte file stream
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3889: 04/27/2015 02:02:15.86
    w3wp.exe (0x1708)                      
    0x15E0
    0x119005                      
    adjzs High    
    [Forced due to logging gap, cached @ 04/27/2015 02:02:15.83, Original Level: VerboseEx] SwitchableSiteMapProvider "{0}" mapped to target provider "{1}"
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3890: 04/27/2015 02:02:15.86
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Database                      
    8acb High    
    [Forced due to logging gap, Original Level: VerboseEx] Reverting to process identity
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3891: 04/27/2015 02:02:15.92
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Database                      
    ahjqp High    
    [Forced due to logging gap, cached @ 04/27/2015 02:02:15.91, Original Level: Verbose] SQL connection time: 0.0963 for Data Source=SPDBTE800-001\MYNET_SQL;Initial Catalog=WSS_Content_80;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max
    Pool Size=100;Connect Timeout=15;Application Name=SharePoint[w3wp][2][WSS_Content_80]
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3892: 04/27/2015 02:02:15.92
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Monitoring                    
    b4ly High    
    Leaving Monitored Scope (EnsureListItemsData). Execution Time=15.9063
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3893: 04/27/2015 02:02:15.98
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Database                      
    ahjqp High    
    [Forced due to logging gap, cached @ 04/27/2015 02:02:15.92, Original Level: Verbose] SQL connection time: 0.0662 for Data Source=SPDBTE800-001\MYNET_SQL;Initial Catalog=WSS_Content_80;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max
    Pool Size=100;Connect Timeout=15;Application Name=SharePoint[w3wp][2][WSS_Content_80]
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3894: 04/27/2015 02:02:15.98
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Database                      
    8acb High    
    [Forced due to logging gap, Original Level: VerboseEx] Reverting to process identity
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3895: 04/27/2015 02:02:16.05
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Database                      
    ahjqp High    
    [Forced due to logging gap, cached @ 04/27/2015 02:02:16.03, Original Level: Verbose] SQL connection time: 0.0856 for Data Source=SPDBTE800-001\MYNET_SQL;Initial Catalog=WSS_Content_80;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max
    Pool Size=100;Connect Timeout=15;Application Name=SharePoint[w3wp][2][WSS_Content_80]
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3896: 04/27/2015 02:02:16.05
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Database                      
    8acb High    
    [Forced due to logging gap, Original Level: VerboseEx] Reverting to process identity
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3897: 04/27/2015 02:02:16.05
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Monitoring                    
    b4ly High    
    Leaving Monitored Scope (EnsureListItemsData). Execution Time=20.7631
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3901: 04/27/2015 02:02:16.19
    w3wp.exe (0x1708)                      
    0x15E0
    0xC33B01F                    
    ahv8s High    
    [Forced due to logging gap, cached @ 04/27/2015 02:02:16.06, Original Level: Verbose] Ending StoreWorkflowDeploymentProvider.GetDefinition
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3902: 04/27/2015 02:02:16.19
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Database                      
    8acb High    
    [Forced due to logging gap, Original Level: VerboseEx] Reverting to process identity
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3903: 04/27/2015 02:02:16.23
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    8kh7 High    
    Cannot complete this action.  Please try again.
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3904: 04/27/2015 02:02:16.25
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Database                      
    ahjqp High    
    [Forced due to logging gap, cached @ 04/27/2015 02:02:16.20, Original Level: Verbose] SQL connection time: 0.0671 for Data Source=SPDBTE800-001\MYNET_SQL;Initial Catalog=WSS_Content_80;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max
    Pool Size=100;Connect Timeout=15;Application Name=SharePoint[w3wp][2][WSS_Content_80]
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3905: 04/27/2015 02:02:16.25
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    aix9j High    
    SPRequest.UpdateField: UserPrincipalName=i:0).w|s-1-5-21-515020923-1814085151-1527837076-26682, AppPrincipalName= ,bstrUrl=http://spwfte800-001 ,bstrListName={0B6B6303-D8AC-4007-94D0-5CF5502DF0F6} ,bstrXML=<Field DisplayName="PublishNewsItemWF-ItemAdded"
    Type="URL" Required="FALSE" ID="{36f69f6b-98df-44f7-b0bd-041265b4b402}" SourceID="{0b6b6303-d8ac-4007-94d0-5cf5502df0f6}" StaticName="PublishNewsItemWF_x002d_ItemAdde" Name="PublishNewsItemWF_x002d_ItemAdde"
    ColName="nvarchar22" RowOrdinal="0" ColName
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3906: 04/27/2015 02:02:16.25
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    ai1wu Medium  
    System.Runtime.InteropServices.COMException: Cannot complete this action.  Please try again., StackTrace:    at Microsoft.SharePoint.SPField.UpdateCore(Boolean bToggleSealed)     at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String
    schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol)     at Microsoft.SharePoint.SPFieldCollection.AddInternal(String strDisplayName, SPFieldType type, Boolean bRequired, Boolean bCompactName, Guid
    lookupListId, Guid lookupWebId, StringCollection choices)     at Microsoft.SharePoint.SPFieldCollection.Add(String strDisplayName, SPFieldType type, Boolean bRequired, Boolean bCompactName, StringCollection choices)     at Microsoft.SharePoint.SPFieldCollection.Add(String
    strDisplayName, SPFieldType typ... 9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3907: 04/27/2015 02:02:16.25*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    ai1wu Medium  
    ...e, Boolean bRequired)     at Microsoft.SharePoint.WorkflowServices.StoreSubscriptionService.CreateStatusColumn(String subscriptionName, SPWeb web, Guid listId)     at Microsoft.SharePoint.WorkflowServices.StoreSubscriptionService.PublishSubscriptionForList(WorkflowSubscription
    subscription, Guid listId)     at Microsoft.SharePoint.WorkflowServices.ApplicationPages.AssocWrkflPage.OnLoad(EventArgs ea)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
    Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext
    context)     at ... 9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3908: 04/27/2015 02:02:16.25*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    ai1wu Medium  
    ...System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception
    error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at
    System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer,
    IntPtr nativeRequestContext, IntPtr mo... 9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3909: 04/27/2015 02:02:16.25*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    ai1wu Medium  
    ...duleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr
    pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr
    rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3910: 04/27/2015 02:02:16.25
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    8nca Medium  
    Application error when access /_layouts/15/AssocWrkfl.aspx, Error=Unable to properly communicate with the workflow service.   at Microsoft.SharePoint.WorkflowServices.ApplicationPages.AssocWrkflPage.OnLoad(EventArgs ea)     at System.Web.UI.Control.LoadRecursive()
        at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3911: 04/27/2015 02:02:16.25
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Runtime                      
    tkau Unexpected
    Microsoft.SharePoint.SPException: Unable to properly communicate with the workflow service.    at Microsoft.SharePoint.WorkflowServices.ApplicationPages.AssocWrkflPage.OnLoad(EventArgs ea)     at System.Web.UI.Control.LoadRecursive()
        at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3912: 04/27/2015 02:02:16.25
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    ajlz0 High    
    Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Microsoft.SharePoint.SPException: Unable to properly communicate with the workflow service.
        at Microsoft.SharePoint.WorkflowServices.ApplicationPages.AssocWrkflPage.OnLoad(EventArgs ea)     at System.Web.UI.Control.LoadRecursive()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
    Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.HandleError(Exception e)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoin...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3913: 04/27/2015 02:02:16.25*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    ajlz0 High    
    ...t)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
        at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3914: 04/27/2015 02:02:16.25
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    aat87 Monitorable
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3915: 04/27/2015 02:02:16.28
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         DistributedCache              
    agyfq Medium  
    Unexpected error occurred in method 'Put' , usage 'SPViewStateCache' - Exception 'Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more
    specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric
    Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.) ---> System.ServiceModel.CommunicationException: The socket connection
    was aborted. This could be caused by ... 9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3916: 04/27/2015 02:02:16.28*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         DistributedCache              
    agyfq Medium  
    ...an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '10675199.02:48:05.4775807'. ---> System.IO.IOException: The read operation failed, see inner
    exception. ---> System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local
    socket timeout was '10675199.02:48:05.4775807'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host     at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags
    socketFlags)     at System.ServiceModel.Channels.So...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3917: 04/27/2015 02:02:16.28*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         DistributedCache              
    agyfq Medium  
    ...cketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)     --- End of inner exception stack trace ---     at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32
    offset, Int32 size, TimeSpan timeout, Boolean closing)     at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)     at System.ServiceModel.Channels.ConnectionStream.Read(Byte[]
    buffer, Int32 offset, Int32 count)     at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)     at System.Net.Security.NegotiateStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest
    asyncRequest)     at System.Net.Security.NegotiateStream.StartReading(Byte[] buffer, Int...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3918: 04/27/2015 02:02:16.28*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         DistributedCache              
    agyfq Medium  
    ...32 offset, Int32 count, AsyncProtocolRequest asyncRequest)     at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)     --- End of inner exception stack
    trace ---     at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)     at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset, Int32 count)  
      at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)     --- End of inner exception stack trace ---    Server stack trace:      at System.ServiceModel.Channels.StreamConnection.Read(Byte[]
    buffer, Int32 offset, Int32 size, TimeSpan timeout)     at System.ServiceModel.Channels...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3919: 04/27/2015 02:02:16.28*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         DistributedCache              
    agyfq Medium  
    ....ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)     at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection
    connection, TimeoutHelper& timeoutHelper)     at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)     at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
        at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)     at Microsoft.ApplicationServer.Caching.CacheResolverChannel.Open(TimeSpan timeout)     at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
    md, Object[] args, Object server, Object[]& outArgs)   ...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3920: 04/27/2015 02:02:16.28*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         DistributedCache              
    agyfq Medium  
    ...  at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message
    reqMsg, Boolean bProxyCase)     at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)     at Microsoft.ApplicationServer.Caching.CacheResolverChannel.OpenDelegate.EndInvoke(IAsyncResult result)
        at Microsoft.ApplicationServer.Caching.ChannelContainer.Opened(IAsyncResult ar)     --- End of inner exception stack trace ---     at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody, RequestBody
    reqBody)     at Microsoft.ApplicationServer.Caching.DataCache.InternalPut(String key, Object value, DataCacheItemV...
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3921: 04/27/2015 02:02:16.28*
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         DistributedCache              
    agyfq Medium  
    ...ersion oldVersion, TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener)     at Microsoft.ApplicationServer.Caching.DataCache.<>c__DisplayClass25.<Put>b__24()     at Microsoft.ApplicationServer.Caching.DataCache.Put(String
    key, Object value, TimeSpan timeout)     at Microsoft.SharePoint.DistributedCaching.SPDistributedCache.Put(String key, Object value)'.
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3922: 04/27/2015 02:02:16.28
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         General                      
    ajb4s Monitorable
    ViewStateLog: Failed to write to the velocity cache: http://spwfte800-001/_layouts/15/AssocWrkfl.aspx?AssociatedList=0b6b6303-d8ac-4007-94d0-5cf5502df0f6&WF4=1
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3923: 04/27/2015 02:02:16.28
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Micro Trace                  
    uls4 Medium  
    Micro Trace Tags: 0 nasq,4 agb9s,66 ak8dj,123 b4ly,132 b4ly,198 aix9j,1 ai1wu,6 8nca,0 tkau,0 ajlz0,1 aat87,20 agyfq,0 ajb4s
    9ac4009d-b5ca-c010-44e2-238aad763833
    Line 3924: 04/27/2015 02:02:16.28
    w3wp.exe (0x1708)                      
    0x15E0
    SharePoint Foundation         Monitoring                    
    b4ly Medium  
    Leaving Monitored Scope (Request (POST:http://spwfte800-001:80/_layouts/15/AssocWrkfl.aspx?AssociatedList=0b6b6303-d8ac-4007-94d0-5cf5502df0f6&WF4=1)). Execution Time=560.4965
    9ac4009d-b5ca-c010-44e2-238aad763833

    Hi Amit,
    Please try using the below cmdlet format to register workflow service to your SharePoint QA server again per the following post with similar error, then check results again. 
    Register-SPWorkflowService -SPSite 'https://myhost/mysite' -WorkflowHostUri 'https://workflowhost' -AllowOAuthHttp -Force
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/46a868eb-a012-4148-8319-088d55671ae7/errors-were-found-when-compiling-the-workflow-the-workflow-files-were-saved-but-cannot-run?forum=sharepointadminprevious
    Thanks
    Daniel Yang
    TechNet Community Support

  • Connect Flash to Serial Port with Local Socket Connection

    Hey all,
    So, I am trying to connect a Flash movie to a serial port
    and have it react to the input coming in. Of course, Flash does not
    have this capability built in, so I need a workaround. I also
    program in Director, and there are easier ways to deal with this
    there, but since there hasn't been an update in years, and for
    other technical reasons, I would like to use a pure Flash program.
    I also need to take advantage of some of the new hardware
    acceleration improvements and horizontal sync issues that come with
    running the Flash player full screen. So, there are some tools out
    there that will let me stream the input from the serial port to a
    web address. I figure I could use the local address and assign a
    port number, then use Flash to create a local socket connection. I
    am having issues opening ports on my computer, and a few other
    things, but in theory, I think it should work. I know that I won't
    get all the answers here, but if anyone has done anything of the
    sort, or might know of some similar projects, it would really help.
    I am more of a Director/Flash programmer, and not so much one on
    the system level. So, opening local sockets, etc, while I am sure I
    can figure it out, is still a bit beyond me. Thanks all!
    - Bruce

    You may want to look into flash remoting, which would allow
    you to push content to the flash movie. You could then write a
    proxy between the source of your stream and flash the remoting
    server.

  • Studio Creator, Socket Connection to External Device

    I am porting an existing & successful project from Netbeans 3.6 into Studio Creator to take advantage of some of the tools in the IDE for this application. The project requires opening a socket connection from the Server PC to an external Device (PLC) that is a Client on a static IP & a dedicated fixed port.
    I am struggling to get past some security settings specific to AccessControlExceptions. Here is the code method being used to test:
    public String button1_action() {
    // Call methods to open connection, init streams, send command, and close connection.
    try {
    // Open Socket up and accept client connection
    ipSocketObject = new ServerSocket(port);
    bfSocket = ipSocketObject.accept();
    // Establish Streams
    is = new BufferedReader(new InputStreamReader(bfSocket.getInputStream()));
    os = new PrintWriter(bfSocket.getOutputStream(), true);
    System.out.println("Got to here...");
    // Clear the msCounter #13002
    os.println("r13002=0");
    pattern = "13002";
    do{ret=is.readLine();} while ((ret.indexOf(pattern)) ==-1);
    is.close();
    os.close();
    bfSocket.close();
    ipSocketObject.close();
    } catch (IOException e) {
    e.printStackTrace();
    return null;
    The Socket Connection is established, but the command string is not processed before Studio Creator generates a AccessControlException Fault. I have experiemented putting in a SocketPermission statement with out success.
    Is anyone aware of some sample code I might be able to review for opening socket connections to clients in a Studio Creator Application? Please excuse this request if too rudimentary- I am an Industrial Controls guy by trade... :)

    Sorry I know of no such application at this time, and unfortunately have not done socket work myself for many moons....
    What JDK was your previous application written under? I googled for AccessControlException and socket and seems that sometimes accounts for some issues... you can also search for that combination in the forum advanced search and might find something there.... one more long shot suggestion based upon your statement "the command string is not processed".... could it be that you need to flush the stream...?
    Sorry I don't have more to offer...
    v

Maybe you are looking for