How to send "close" message to server when client directly close computer?

hi~~
I now have a 9 ppl multiplay game with Socket connection. The clients can sucessfully send a message to server whey they close the game down through pressing X button,but they cant send message when they directly close computer.
I want to know how to make so available?
thank

Whenever we put our computer off directly(like power
failure), there is no way to inform other computer
about this mishap. Now it's responsibility of server
to judge this scenario. In case of sockets, whenever
we try to write or read from socket whose connection
is broken, exception is thrown. No. TCP does not work like that.
If you read from a socket and the other computer aborted the connection, then either the read will timeout (if a read timeout is set) or block forever.

Similar Messages

  • How to send a message from server to a particular client

    Hi all,
    I need to send a message from one host to another host which are connected in local domain. Now I'm able to send a message from client to server and vice versa but what I need is the server should route that message which I send through one client to another host(client) .
    How can I do that ?
    Please give me some ideas how to do that .
    Thanks in advance
    Edited by: m.parthiban on Mar 5, 2008 1:20 PM

    ejp, thanks for your reply . can you please explain me bit more by providing code snippet ?
    This is what I have done till now :
    MyServer:
    package connection;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class MyServer {
          * @param args
         public static void main(String[] args) {
              String ss ="",temp ="";
              Socket clientLink=null;
              try {
                        ServerSocket sockServer = new ServerSocket(6000);
                        while(true) {
                             clientLink = sockServer.accept();
                             System.out.println("Connection Established");
                             InputStreamReader isr = new InputStreamReader(clientLink.getInputStream());
                             BufferedReader bufReader = new BufferedReader(isr);
    //                         System.out.println("buf "+bufReader.readLine());
                             try {
                                  while ((temp=bufReader.readLine())!=null) {
                                       ss+=temp;
                                       System.out.println("ss   "+ss+"Temp "+temp );
                                  System.out.println("Client > "+ss);
                             } catch (IOException e) {
                                  System.out.println("while reading");
                                  e.printStackTrace();
                             OutputStreamWriter osw = new OutputStreamWriter(clientLink.getOutputStream());
                             PrintWriter pw = new PrintWriter(osw,true);
                             pw.write("Welcome -by Server !!!");
                             pw.flush();
                             clientLink.shutdownOutput();
                             clientLink.close();
              } catch (IOException e) {
                   System.out.println("Can't able to connect");
                   e.printStackTrace();
    }MyClient:
    package connection;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import java.net.Socket;
    import javax.swing.JOptionPane;
    public class MyClient {
          * @param args
         public static void main(String[] args) {
              try {
                   String serverMsg="",temp="";
                   Socket client = new Socket("127.0.0.1",6000);
                   PrintWriter pw = new PrintWriter(client.getOutputStream(),true);
                   pw.write("Hi ,Accecpt me");
                   pw.flush();
    //               pw.close();
                   client.shutdownOutput();
                   InputStreamReader isr  = new InputStreamReader(client.getInputStream());
                   BufferedReader bufRead = new BufferedReader(isr);
                   while ((temp=bufRead.readLine())!=null) {
                        serverMsg +=temp;
                   System.out.println("Server > "+serverMsg);
                   JOptionPane.showMessageDialog(null, serverMsg);
                   client.shutdownInput();
                   client.close();
              } catch (IOException e) {
                   System.out.println("Failed to connect");
                   e.printStackTrace();
    }Once again thanks for the time you spend to reply me.

  • How to send Subtopic Message From Server-Side to Client ?

    I’m new at flex and i have a new question about Flex
    Message Service.
    How to send messages from Server-Side Java Code with
    Subtopic?
    For example.
    I customed a Flex Message Adapter in Tomcat Server , with
    this Adapter , i can send message to Client with following code .
    ---------------------Send message to Client------------
    MessageBroker msgBroker =
    MessageBroker.getMessageBroker(null);
    String clientID = UUIDUtils.createUUID(false);
    AsyncMessage msg = new AsyncMessage();
    msg.setDestination("CustomMsgServiceDes");
    msg.setClientId(clientID);
    msg.setMessageId(UUIDUtils.createUUID(false));
    msg.setTimestamp(System.currentTimeMillis());
    msg.setBody(clientID + "this is my message from server! \n");
    msgBroker.routeMessageToService(msg, null);
    ---------------------Send message to Client------------
    But i want send a message that have Subtopic to the Client ,
    How to do ?
    Thank you for reply.

    There's a white paper that talks about this subject -
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=8f1eb6ea

  • Sending XML messages from server to client using POST method

    Dear everyone,
    I have a simple client server system - using Socket
    class on the server side and URLConnection class on
    the client side. The client sends requests to the
    server in the form of an XML message using POST method.
    The server processes the request and responds with
    another XML message through the same connection.
    That's the basic idea.
    I have a few questions about headers and formats
    especially with respect to POST.
    1. In what format should the response messages from the
    server be, for the client? Does the server need to
    send the HTTP headers - for the POST type requests?
    Is this correct?:
       out.println("HTTP/1.1 200 My Server\r");
       out.println("Content-type: text/xml\r");
       out.println("Content-length: 1024\r");
       out.println("\r");
       out.println("My XML response goes here...");2. How do I read these headers and the actual message
    in the client side? I figured my actual message was
    immediately after the blank line. So I wrote
    something like this:
       String inMsg;
       // loop until the blank line is through.
       while (!"".equals(inMsg = reader.readLine()))
          System.out.println(inMsg);
       // get the actual message and process it.
       inMsg = reader.readLine();
       processMessage(inMsg);But the above did not work for me. Because I seem to
    be receiving a blank line after each header! (I suppose
    that was because of the "\r".) So what should I do?
    3. What are the different headers I must pass from
    server to the client to safeguard against every
    possible problem?
    4. What are the different exceptions I must be prepared
    for this situation? How could I cope with them? For
    example, time outs, IOExceptions, etc.
    Thanks a lot! I appreciate all your help!
    George

    hello,
    1) if you want to develop a distributed application with XML messages, you can look in SOAP.
    it's a solution to communicate objects distributed java (or COM or other) and it constructs XML flux to communicate between them.
    2) if it can help you, I have developed a chat in TCP/IP and, to my mind, when you send datas it's only text, so the format isn't important, the important is your traitement behind.
    examples :
    a client method to send a message to the server :
    public void send(String message)
    fluxOut.println(message);
    fluxOut.flush();
    whith
    connexionCourante = new Socket(lAdresServeur, noPort);
    fluxOut= new PrintWriter( new OutputStreamWriter(connexionCourante.getOutputStream()) );
    a server method in a thread to receive and print the message :
    while(true)
    if (laThread == null)
    break;
    texte = fluxIn.readLine();
    System.out.println(texte);
    that's all ! :)
    If you want to use it for your XML communication, it could be a good idea to use a special message, for example "@end", to finish the server
    ex :
    while(true)
    if (laThread == null)
    break;
    texte = fluxIn.readLine();
    // to stop
    if (texte.equals("@end"))
    {break;}
    processMessage(texte );
    hope it will help you
    David

  • How to push the offline chat messages to server when internet is available

    I am building chat application in windows phone 8.1 When internet is not available in the device i am storing all chat messages in sqlite database. I want push those messages to server when internet is available later even thought app is not open/active.
    please help me to solve this problem. thank you 
    vinay

    The best approach likely would be to use triggered background tasks. There is a specifc trigger for "InternetAvailable" which looks like a perfect match for your requirement. This article describes that feature in more detail:
    https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh977058.aspx
    If I remember correctly however usage of SQLite in background tasks can be somewhat problematic (my information on that may be old however). My suggestion in that case would be to serialize the messages into an XML file when your App is suspended/closed
    which is likely to be a lot easier to handle in the background task (regular storage can remain in the SQLite database).

  • Tutorial announcement :: How to send a message(s) with attachments ::

    How to send a message with attachments Using Adobe Dreamweaver CS3 and Developer Toolbox...
    - In this tutorial you will use Developer Toolbox features to build a simple contact us form with the advantage to upload file with your message and send this file via e-mail as an attachments.
    Using This application will allow to:
    * insert records into database and then send them via e-mail.
    * upload files to the server.
    * send message with uploaded files as attachments.
    This tutorial contains one part
    1. insert record, and then send it by email with (attachments).
    By following this tutorial section, you will create:
    * Page for inserting records.
    * Page for thank you when the message is sent.
    :: To View the tutorials ::
    :: Online Demo ::
    Brought t you by:
    www.developer-online.com

    Open the photo, assuming it is in Photos, and then in the lower left corner under the photo is a box with an up-pointing arrow.  Tap that box, and then the photo will have a blue circle with a checkmark in its lower right corner and the word Next at the upper right.  Tap Next, then choose how you want to send the photo, by text message, email, and so on.  Simply address the method you have chosen and put in any text you want to include.

  • Best Practices Question: How to send error message to SSHR web page.

    Best Practices Question: How to send error message to SSHR web page from custom PL\SQL procedure called by SSHR workflow.
    For the Manager Self-Service application we’ve copied various workflows which were modified to meet business needs. Part of this exercise was creating custom PL\SQL Package Procedures that would gather details on the WF using them on custom notification sent by the WF.
    What I’m looking for is if/when the PL\SQL procedure errors, how does one send an failure message back and display it on the SS Page?
    Writing information into a log or table at the database level works for trouble-shooting, but we’re looking for something that will provide the end-user with an intelligent message that the workflow has failed.
    Thanks ahead of time for your responses.
    Rich

    We have implemented the same kind of requirement long back.
    We have defined our PL/SQL procedures with two OUT parameters
    1) Result Type (S:Success, E:Error)
    2) Result Message
    In the PL/SQL procedure we always use below construct when we want to raise any message
    hr_utility.set_message(APPL_NO, 'FND_MESSAGE_NAME');
    hr_utility.raise_error;
    In Exception block we write below( in successful case we just set the p_result_flag := 'S';)
    EXCEPTION
    WHEN APP_EXCEPTION.APPLICATION_EXCEPTION THEN
    p_result_flag := 'E';
    p_result_message := hr_utility.get_message;
    WHEN OTHERS THEN
    p_result_flag := 'E';
    p_result_message := hr_utility.get_message;
    fnd_message.set_name('PER','FFU10_GENERAL_ORACLE_ERROR');
    fnd_message.set_token('2',substr(sqlerrm,1,200));
    fnd_msg_pub.add;
    p_result_message := fnd_msg_pub.get_detail;
    After executing the PL/SQL in java
    We have written some thing similar to
    orclStmt.execute();
    OAExceptionUtils.checkErrors (txn);
    String resultFlag = orclStmt.getString(provide the resultflag bind no);
    if ("E".equalsIgnoreCase(resultFlag)){
    String resultMessage = orclStmt.getString(provide the resultMessage bind no);
    orclStmt.close();
    throw new OAException(resultMessage, OAException.ERROR);
    It safely shows the message to the user with all the data in the page.
    We have been using this construct for a long time for all our projects. They are all working as expected.
    Regards,
    Peddi.

  • How to send File on application server for Attachment

    Hi,
    Friends in my application file is to be sent with Email as an attachment.
    all this to be done via servlet for that i have to send the file to application server from there servlet will send mail via Email server.
    How can send this file to server.
    plz help me .
    Thanks

    Hi,
    The following program illustrates the creation of ifle in app server and reading the file from appli server:
    DATA: ITAB LIKE vbakOCCURS 0 WITH HEADER LINE.
    PARAMETERS: P_VBELN LIKE VBAP-VBELN.
    START-OF-SELECTION.
      SELECT *
        FROM VBAP
        INTO TABLE ITAB
    WHERE VBELN = P_VBELN
        PERFORM WRITE_DATA.
        PERFORM READ_DATA.
    *&      Form  WRITE_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM WRITE_DATA.
    OPEN DATASET 'VBAP_DATA' FOR OUTPUT IN TEXT MODE.
    LOOP AT ITAB.
    TRANSFER ITAB TO 'VBAP_DATA'.
    ENDLOOP.
    CLOSE DATASET 'VBAP_DATA'.
    CLEAR: ITAB, ITAB[].
    ENDFORM.                    " WRITE_DATA
    *&      Form  READ_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM READ_DATA.
    OPEN DATASET 'VBAP_DATA' FOR INPUT IN TEXT MODE.
    DO.
    READ DATASET 'VBAP_DATA' INTO ITAB.
    IF SY-SUBRC <> 0.
    EXIT.
    ENDIF.
    APPEND ITAB.
    ENDDO.
    CLOSE DATASET 'VBAP_DATA'.
    LOOP AT ITAB.
    WRITE:/ ITAB-VBELN,
            ITAB-POSNR.
    ENDLOOP.
    ENDFORM.                    " READ_DATA
    If it is helpful rewards points
    Regards
    Pratap.M

  • HT3529 how to send group messages in ios 7.0.2

    please tell me how to send group messages in iphone 5 with ios7.0.2

    Oh yeah, now I remember that.
    But I also remember that you had to go all the way to the start of the message to gain access to the current contact information. Where as in iOS7 that button you mentioned is the contact information. Personally I perfer iOS7. I don't delete my messages, so this is better for me.
    However, it wouldn't be a bad idea to add an Edit button in that sub menu that shows up when you touch the upper right button. Currently there are opitions for "Phone", "FaceTime" and "Information" on the contact.
    KOT

  • How to send a message with a photo to a company?

    I AM S DISABLED SENIOR WITH SHORT-TERM MEMORY. PLEASE TELL ME HOW TO SEND A MESSAGE AND INCLUDE A PHOTO I HAVE ON MY i-PHONE 5S?
    THANK YOU IN ADVANCE FOR THE ASSISTANCE.
    FLIGHTLEADER-1

    Open the photo, assuming it is in Photos, and then in the lower left corner under the photo is a box with an up-pointing arrow.  Tap that box, and then the photo will have a blue circle with a checkmark in its lower right corner and the word Next at the upper right.  Tap Next, then choose how you want to send the photo, by text message, email, and so on.  Simply address the method you have chosen and put in any text you want to include.

  • How to send a message to a pager? URGENT

    Hi everybody
    I wanna know how to send a message (or a caller's number) to a pager from Form.

    Hi,
    if you can find a public Webservice on the Web that provides this functionality, you could use JDeveloper and the Forms Java Importer to call it from Forms.
    JDeveloper is helpful in creating the Java skeletton to communicate with the Webservice. As similar issue is covered in teh Forms9i demos by the example of a currency converter.
    Frank

  • How to send ALL message that is in Outbox without ...

    How to send ALL message that is in Outbox without doing it one by one sending?
    All status is either deferred, or failed. is there a way that can auto resend but not doing it one by one?
    I have hundred of message un-send and stuck in outbox.
    Please help.

    try select options then scroll down to mark mark all if this does not work you will either have to delete or resend,you can delete all messages via the same mark all option your best of to just remove,also keep your inbox to a minimum
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

  • How to send text messages using my Laptop

    How to send text messages written on my Laptop on my Curve8520 with Orange network?

    umm... you don't. SMS is a function of the BlackBerry, not your PC.
    There could a desktop software for SMS, but I don't know what it would be.
    **edit, well this looks like it would work.
    http://download.cnet.com/Desktop-SMS/3000-10440_4-​10340430.html
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to send e-mail notification automatically when a record is inserted?

    Dear All,
    Could anyone kindly tell me how to send e-mail notification automatically when a record is inserted through a form in Oracle Portal Release 2?
    Regards,
    Ridwan.

    Hi,
    If you are writing a form on a table then you can call the mail API from a database trigger on the table. If it is a form on a procedure, you can make the email call from the procedure. To know more about sending mails from plsql go to
    http://www.quest-pipelines.com/newsletter-v2/smtp.htm
    Thanks,
    Sharmila

  • How to register and unregister Mbean server when jvm is crashed.

    Hi All,
    how to register and unregister Mbean server when jvm is crashed with specifying like internal error(xxxxxxxxxxxsome number)
    I am getting error NameAlreadyBindExcetion when i call the below method in my program, how to unregister and register again, can any one can help on this topic?
    internalConnectorService.start();
    regards
    Prasad.Nadendla

    Looks like your server object is already bound and registered and your trying to re-register the same...
    is that a corba server? if yes, you'd be able to check that with the NamingService tools

Maybe you are looking for

  • Problem in VAT Round off during MIRO

    Hi Friends, I having problem in VAT round off during MIRO. We have created PO with excise +VAT. VAT amount has been rounded off. After GRN, we are trying to post the Invoice in MIRO, the VAT amount shows with Decimal. We are using TAXINN, in the tax

  • License key won't "stick"

    Hi, I'm administering a Contribute site for about 20 users. I installed and licensed all of my authors' copies of 3.0 without incident with one exception: one user's license key won't "stick"--she's prompted for the license number every time she open

  • I JUST CAN'T BELIEVE IT !

    I have posted a question about using an external bootable drive on this forum. One answer was coming at the time I called Apple Care for which I paid to go with my IMAC. After spending a LONG time dealing with an incompetent person acting as a filter

  • Picking strategy M issue

    Hi People, I am using picking strategy as M (small and large quantities). In my materials, I have defined control quantity as 30 cs. So when a transfer order is created for more than 30 cs, system picks from 001 storage type and if TO quantity is les

  • User Exits or BADIs for MM41/42 in SAP Version 4.6b

    My requirment is that when the user create a new article by MM41 or changes an existing one by MM42. Certain checks shoud be applied. Checks required are:- 1)Articles should always have their Unit of Dimension as “MM”(other dimensions should not be a