Send Message Client to Client Via Server

Hi,
I am trying to create Messenger similar to msn but very simple.
I have managed to create some parts of it after nonstop day night reading up on sockets, and threading etc.. so so far i have a Server + ServerThread and Client class, which is capable of:
* Server that can accept multiple client connections.
* Each client can send message to the server Only
Thats all so far but I do intend to
* Make Client send Client messages via the Server <-- Next Important Step
* Add and Remove Users (User Lists)
Lets say I have a Server (S) and Clients (C1) and (C2)
at the moment both C1 and C2 can connect to S and send messages to it only.
How can I, or what would I need to do so that I can make C1 and C2 actually send each other messages? I understand I may need the server to somehow get the messages recieved from C1 and C2 and send them to one another?
Do correct me in my assumptions or methods I am using, as you may know better methods or techniques to use to implement what I need to do.
Thanks
QTQ
P.S If you need anymore information in regards to this or have any questions, please do ask.

thanks topfoxy for the reply, I've managed to send msgs to everyone and private... but used a different method i think.. basically on each connection it would add the sockets to a vector list adn the same with usernames. and to send to everyone on the server the thread will just loop all the socket vector sending it to each user.. on private it will use the uservector to get the index of the user name and then using that index to get hte socket and hten sending it to that socket only... :)... what do you think? good or bad?

Similar Messages

  • How can local user send message to other user via OSX server in mac maverick

    I just install OS X server in mac mavericks and enable services such as message, DNS, VPN, etc. I also create local users and local network users. I add some local users from OSX server to Message app in order to message to server, but I cannot send any message to those user, even Bonjour is available but I cannot use it to send message in local network.
    I already followed all Server Help in Messages like in this image:
    I try to access to my local OS X server via IP address by using other PC, Mac and iPhone and I can get this interface:
    I already try in iPhone to send message to local user in OS X server after accessing to OS X server via IP Address, but I don't know how local user can get that message and I see nothing in message_archives of message data of server. Therefore, how each user in OSX server can message to each other across OSX server ? Does Admin have to write some codes or make configuration for providing message services to those users ?
    Message was edited by: chhanmalin

    Client users need to use XMPP client app to log in to server with account name like in server , then user can send message to other users in server. Client users can use iphone, pc, or mac.

  • How to send message, client to client?

    Hi friends,
    I would like to send message from form6i to new client.
    In OS w2k is works.. but window98 isn't.
    HOST('NET SEND 199.19.1.11 MESSAGE'); -- > W2K
    HOST('........'); --> W98 ????????
    Anybody to know.... ???
    Thanks.

    I think,
    to solve this problem, like you think, is not direct possible.
    First, the IP you see on server is not sure the real IP from client. It could be the IP from the ISP or from some Proxy. To solve this problem Servlet use the HttpSession class. This class use either a cookie or the URL to recognize the client.
    Second, http protocoll is a stateless protocoll. In one fact this means that the server can't send a message to a client when no request is comming from client!
    You have to solve the problem on client side.
    My you can solve it like follow:
    Write a from that send a request to server.
    On server you check the state from your your process. If the process is free, lock the process by set some global variable to lock and proceed the request. If the process is looked anser by sending html with send a message via JavaScript or display it with HTML and use the html metatag to reload some seconds later this page again.
    I hope this help you
    Regards Dietmar

  • I don't know how to send message to my friends via message

    I downloaded mountain lion yesterday but I don't know how to send message to the imessage on ipad or iphone. The account of my friend's seems doesn't work and I have no access to sending message to that account.

    Welcome to Apple Communities
    Press the + button to select a contact. Then, write whatever you want in the white box and press Enter key. You can use it with contacts with iPhone, iPod touch, iPad or Mac with Mountain Lion

  • Connecting 2 Clients via Server

    Hi,
    I asked a question about this a while ago, and got some helpful answers, but I just can't seem to get my head 'round the idea. I have 2 clients, and I want them each to connect to the server, and for the server to pair them up, and pass them off to a handler to do all the work.
    The connection part of my client code:
    public void start()
            try{           
                    InetAddress address = InetAddress.getByName("localhost");
                    connect = new Socket(address, PORT);
                input = new BufferedReader(new InputStreamReader(connect.getInputStream()));
                output = new PrintWriter(connect.getOutputStream(), true);
                thread = new Thread(this);
                thread.start();           
            catch(IOException exception)
                System.out.println("Error connecting to server " + exception);
        }The server code:
    public Server()
            try
                //create server socket to listen for connections
                ServerSocket server = new ServerSocket(8000);
                while(true)
                    //create socket when connection made
                    Socket connection = server.accept();
                    //assuming the 2 client connection goes here
                    Handler thread = new Handler(connection);
                    thread.start();
            catch(IOException exception)
                    System.out.println("Error connecting: " + exception);
        }I have a feeling I'm just being really stupid about this, but I'd be really grateful if anyone could give me a clue, as it's really doing my head in!
    C

    hi there,
    I believe rather than letting the server to connect two clients in two different threads, its beter if the server keeps two seperate connections with each clients and pass the required information about each clients -- viz. IP and Port nos.
    Once each client gets their respective IP and Port no. , the clients themselves can connect to each other bypassing the server and helpin the load off the server machine.
    Its like peer-2-peer computin.
    i hope this idea can help
    samabhik

  • Sending messages but not saving to server

    Since updating to Lion I've been able to use the Mail client to access Yahoo! Mail (the free version, not Yahoo! Mail Plus) for the first time.
    Mail is receiving and sending mail fine but messages composed and sent within Mail are not saving to the Yahoo! server.
    Within the Preferences the "store sent messages on the server" is checked.
    The Mail Connection Doctor has green lights.
    I sent myself a test message using a different email address (within the mail client) which did store on the server.
    Any ideas?

    Chris Cox wrote:
    The CS6 icons are exactly as Apple requested them.
    Apple are publicly advising developers to use application and document icons which contain a pyramid of images from 16 x 16  to 1024 x 1024 pixels, the largest size being intended for Retina displays.
    You have stated in another thread that the Photoshop CS6 change from previously-compliant icons of CS5 to new less-useful and non-compliant icons is because Apple requested the change in preparation for Retina.
    The request is clearly illogical, therefore there seems a high probability of a communication error between Apple and Adobe, or a mistake by someone at Apple or by someone at Adobe.
    Will the icons in the next Ps update be compliant with Apple's public guidelines?
    https://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGu idelines/IconsImages/IconsImages.html#//apple_ref/doc/uid/20000967-TP6
    Extract:
    Provide a set of document icons in the same set of sizes you provide for your app icon. For the recommended standard- and high-resolution sizes, see Table 5-1.
    As you do with your app icons, create an .icns file for your document icons. To learn more about how to create this type of file, see “Tips for Designing Icons.”
    Table 5-1  App icon resource sizes
    Filename
    Size of canvas (in pixels)
    icon_512x512@2x
    1024x1024
    icon_512x512
    512x512
    icon_256x256@2x
    512x512
    icon_256x256
    256x256
    icon_128x128@2x
    256x256
    icon_128x128
    128x128
    icon_32x32@2x
    64x64
    icon_32x32
    32x32
    icon_16x16@2x
    32x32
    icon_16x16
    16x16
    Note: PNG with an sRGB color profile is the recommended format for app icons.

  • ** Is it possible to send message directly to the AS2 server using URL

    Hi friends,
    We have Axway (B2B) Integration software trial version. We have XI system in which AS2 adapter is installed.  We want to send EDI file directly from Axway to AS2 adapter of XI by calling the AS2 server URL.
    http://<server>:50100/SeeburgerAS2/AS2Server
    We have created one File to File scenario in Axway. We have one File to AS2  scenario in XI also.  Now, Presently, the scenario in Axway works like, to pick the file from Axway  and  delivers the output file which is the source directory mentioned in sender CC of XI thru FTP in Axway.  Then, XI automatically poll this file and send to AS2 adpater. Instead, we want to send EDI file directly from Axway to AS2 server. We tried the scenario in Axway, but not able to call the URL directly. Any idea, friends.
    Kindly reply friends.
    Thanking you.
    Kind Regards,
    Jeg P.

    ok, and i answered you
    where's the problem? why you can not send this message? is the problem in axway? or you can't see message in the XI? If you can send it from axway and it doesn't reach the XI, what information do you have in your axway log?
    p.

  • Problem sending message, temporary size limit of server

    I get this message when I try to send mail with attachments of less than 365 KB. "The size of the message you are trying to send exceeds a temporary size limit of the server. The message was not sent; try to reduce the message size or wait some time and try again. The server responded: 4.1.1...temporary failure." This just started happening. I've e-mailed files with much larger attachments and never had an issue. I tried e-mailing smaller attachments with the same results. I also tried waiting until the next business day hoping that the issue would resolve itself to no avail.
    Please Help!
    Kim

    The error message is coming from your email providers server. What do they say when you ask them what is wrong with their equipment?

  • How do i change imessage settings on Mac to stop RTN = Send message

    how do i change imessage settings on Mac to stop RTN = Send message.
    Is there sa setting so that Imessage on mac can be the same as iphone.... I need to be able to send messages as i would via iphone, with differnt data on different lines, therefore using the RTN key to go to the next line?
    thanks

    If you hold down option while pressing return, it should move the cursor to the next line without sending the message. 
    I hope this helps!

  • Example of Weblogic Appserver using XA Controlled Transaction to send messages to third party JMS

              I am looking for Example of Weblogic Appserver using XA Controlled Transaction
              to send messages to third party JMS Server.
              I want to send messages to JMS and use Weblogic MDB to consume that message and
              send it to some third party JMS in a XA Controlled transaction.
              

    Sure. Right now, it involves a bit of JTA programming -- in our next
              release, it should be easier, however.
              Before sending a message, you have to:
              -- Use the TxHelper class to get the current Transaction object.
              -- Use the "getXAResource" method on the JMS provider's Session object to
              get the XAResource object for the JMS Session you're using to send.
              -- Call "enlistResource" on the Transaction object.
              You MUST do this in every transaction where you use the JMS provider to send
              a message.
              You can find the documentation for the TxHelper class and other
              WebLogic-specific classes here:
              http://e-docs.bea.com/wls/docs70/javadocs/index.html
              Look for the "weblogic.transaction" package.
              You can find documentation for the Transaction class (which defines
              enlistResource) and other classes here:
              http://java.sun.com/products/jta/javadocs-1.0.1/index.html
              You should also use the weblogic.transaction.TransactionManager class and
              call "registerDynamicResource" once (and only once) in your application to
              register the JMS providers XAResource with JTA. This makes JTA more
              efficient, and it makes transaction recovery work properly.
              If the JMS provider is MQ, then look at the whitepaper "Using JTA
              transactions to envelope WLS JMS and IBM MQSeries" here:
              http://dev2dev.bea.com/resourcelibrary/whitepapers.jsp?highlight=whitepapers
              And finally, if you have more questions, the transaction people will be able
              to help more. Post to "weblogic.developer.interest.transaction".
              greg
              "Neeru Munjal" <[email protected]> wrote in message
              news:[email protected]...
              >
              > I am looking for Example of Weblogic Appserver using XA Controlled
              Transaction
              > to send messages to third party JMS Server.
              > I want to send messages to JMS and use Weblogic MDB to consume that
              message and
              > send it to some third party JMS in a XA Controlled transaction.
              >
              

  • MFC Client cannot send message to a Java Server

    Hi All,
    I have a Java Server which listens on a TCP Socket. The client is a MFC based application and needs to communicate with the Server using simple raw text messages.
    We were able to connect to the Java Server using CSocket and CAsyncSocket objects but were not able to send messages.
    This is the code that we are trying:
    mySock = new CAsyncSocket(); // mySock is a CAsyncSocket object.,
    mySock->Create();
    mySock->Connect(strIP,lngPort);
    mySock->Send(strMessage, nSize);
    The server log shows that the connection is established, but the message doesnt reach.
    Please help !
    Thanks !!
    Sudhakar.

    I have the same problem.
    The Java (server) end is straightforward...
    Ian
    import java.io.*;
    import java.net.*;
    public class Serv extends Thread
         public static final int PORT = 3011;
         public static final String REQUEST = "REQUEST";
         /** Test */
         public static void main(String[] args)
              Serv s = new Serv();
              s.start();
         Serv()
              try
                   // Real code will set this class to be a daemon thread as we want it to stop is the main thread stops
                   //ss.setDaemon(true);
                   m_serverSocket = new ServerSocket(PORT);
              catch (IOException ex)
                   ex.printStackTrace();
         public void run()
              try
                   while (true)
                        // Launch a handler when a client connects:
                        final Socket clientSocket = m_serverSocket.accept();
                        ClientHandler clientHandler = new ClientHandler(clientSocket);
                        System.out.println("(Client " + clientHandler.getClientHostname() + " accepted on port " + PORT + ")");
                        clientHandler.start();
              catch (IOException ex)
                   ex.printStackTrace();
         private class ClientHandler extends Thread
              ClientHandler(Socket clientSocket)
                   try
                        setDaemon(true);
                        m_clientSocket = clientSocket;
                        m_socketWriter = new PrintWriter(new BufferedOutputStream(m_clientSocket.getOutputStream()));
                        m_socketReader = new BufferedReader(new InputStreamReader(m_clientSocket.getInputStream()));
                   catch (IOException ex)
                        ex.printStackTrace();
              public void run()
                   try
                        //m_socketWriter.println(getAlarmSummaryString());
                        //m_socketWriter.flush();
                        while (true)
                             final String request = m_socketReader.readLine();
                             System.out.println("Client request: " + request);
                             if (request.equals(REQUEST))
                                  m_socketWriter.println("RESPONSE");
                                  m_socketWriter.flush();
                             else
                                  m_clientSocket.close();
                                  break;
                   catch (SocketException ex)
                        System.out.println("(Client " + getClientHostname() + " disconnected)");
                   catch (IOException ex)
                        ex.printStackTrace();
              private String getClientHostname()
                   return ((InetSocketAddress)m_clientSocket.getRemoteSocketAddress()).getHostName();
              private Socket m_clientSocket;
              private PrintWriter m_socketWriter;
              private BufferedReader m_socketReader;
         private ServerSocket m_serverSocket;
    }

  • Send Message from RMI Server to RMI Client

    Hi,
    I want to send message to RMI Client throw RMI server to refresh client's data object as it is database application. I guessed i could implement an interface on client side and i can register my client to the server by sending object to the server. It is not helping it is throwing NULL Pointer exception on server side and it is not refreshing. It seems like it is not passing by reference.
    Can any one please guide me with how to send messages to clinet. What is the best way to do it?
    -A Thakkar.

    You need to elaborate the object model of your client. When you run into this situiation where you might have to sublass two different objects, then you should take a look at breaking the client itself into more than one object.
    Let me put it another way: A JFrame is a GUI object; why would you ever try to callback a GUI object? Can't you create - say - a CallbackHandler, and let it initiate further action in the client?

  • How to send message to Client about Server shutdown.

    I have made a Chatting Application using RMI.
    I need to send messages to all the Clients when a Server shutdowns abnormally.
    One way is that I use shutdown hook on the Server Application.
    But, what if the power of the machine on which server is running goes off. How will the Client get to know that server is down.
    I also want that If a Client shutdowns abnormally,it should send the message to the Server which in turn will send message to other Clients about the particular Client.
    Thanks & Regards.
    Nimesh

    Before you make any call form client to server check that sever is available. This is easily done by intorudciing an rmi method that will return true e.g m_sever.isAvalable(); if server is availbel you will get ture if not then you will get an RMI Excpetion which you then trap and attemp to reconnect to the server (NAming.lookup() ) .. if several attempts fail then assume server is down.
    When a client dies it throws an excpetion on the sErver :
    java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:116)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
         at java.io.FilterInputStream.read(FilterInputStream.java:66)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:442)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:536)
    trap this and deal with it appropriatly.
    hope this helps.
    Charbel.

  • Send message with abap proxy client

    I'm trying to send message to XI, but no message in sxmb_moni.
    I have created logical port with LPCONFIG.
    ABAP code
    REPORT  Z_HTTP_SEND.
    DATA:
    * Reference variables for proxy and exception class
      lo_clientProxy     TYPE REF TO ZPCO_MI_COMPANY_OB,
      lo_sys_exception   TYPE REF TO cx_ai_system_fault,
    * Structures to set and get message content
       ls_request         TYPE ZPMT_COMPANY_ID,
       ls_response        TYPE ZPMT_COMPANY_DETAILS.
    *Complete the structure ls_request for the request message.
    *DATA: zmt_id type ZPMT_COMPANY_ID,
    *zdt_id type ZPDT_COMPANY_ID,
    *z_id_tab type ZPCOMPANY_ID_TAB,
    *z_id type ZPCOMPANY_ID.
    *z_id-COMPANY_ID = '3000'.
    *append  z_id to z_id_tab.
    *  zdt_id-RECORD = z_id_tab.
    *zmt_id-MT_COMPANY_ID = zdt_id.
    DATA tab TYPE ZPCOMPANY_ID_TAB WITH HEADER LINE.
    tab-COMPANY_ID = '3000'.
    APPEND tab.
    ls_request-MT_COMPANY_ID-RECORD = tab[].
    TRY.
    * create proxy client
    *CREATE OBJECT lo_clientProxy( u2018LOGICAL_PORT_NAMEu2019 ).
        CREATE OBJECT lo_clientProxy.
    * do synchronous client proxy call
        CALL METHOD lo_clientProxy->execute_synchronous
                 EXPORTING output  = ls_request
                 IMPORTING input   = ls_response.
        CATCH cx_ai_system_fault INTO lo_sys_exception.
    *   Error handling
    ENDTRY.
    Any ideas? Thanks very much,

    Hi,
    Proxies communicate with the XI server by means of native SOAP calls over HTTP .RFC does not, so you have to convert from SOAP to RFC calls and vice versa. So XML conversion is required.
    ABAP Proxies uses Webservice and Http Protocols. And if you use RFC it is mainly meant for Sync. call. But Proxies is used for both Sync and Async.
    If you use ABAP Proxy , you can reduce the overhead calling the function again and again.
    How do you activate ABAP Proxies? - Activate Proxy
    ABAP Server Proxies - ABAP Server Proxy
    ABAP Proxies in XI(Client Proxy) - ABAP Client Proxy
    Re: JDBC Sender select/update problem
    If u generate proxy for outbound interface then its client proxy and for inbound interface its server proxy.
    In client proxy u can call the method to send messages but u can't modify it but in server proxy its possible to write a user code within the method to execute proxy.
    CLIENT PROXY:
    A WSDL description from a UDDI server (or an Internet page) is usually used to make a service executable in the Internet and to describe the interface of this service. You require a client proxy and not a server proxy to call this service by using the Web service infrastructure.
    SERVER PROXY:
    You can only generate ABAP server proxies from a WSDL description if they originate in the Integration Repository.You can also generate server proxies for Java and client proxies for ABAP from message interfaces.
    s refer these doc about ABAP proxy ..
    How do you activate ABAP Proxies? - Activate Proxy
    ABAP Server Proxies - ABAP Server Proxy
    ABAP Proxies in XI(Client Proxy) - ABAP Client Proxy
    Re: JDBC Sender select/update problem
    ABAP Server Proxies
    How do you activate ABAP Proxies?
    ABAP Proxies in XI(Client Proxy)
    File to R/3 via ABAP Proxy
    http://help.sap.com/saphelp_nw2004s/helpdata/en/48/d5a1fe5f317a4e8e35801ed2c88246/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/ba/f21a403233dd5fe10000000a155106/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/41e08c90-0201-0010-9197-d8774336ea78
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0ae9874-109c-2910-f48a-e91f0cdd1c81
    Smarter Approach for coding ABAP Proxies
    regards,
    Surya

  • Retrieving the Message Header In Asyn Scenario With Sender As Client Proxy

    Hi All,
    I have a asynchronous scenario (XI to SOAP),where on the sender side Client Proxy is being triggered by an ABAP Report.
    My problem is,that as the Proxy is in Sender Side I am not able to get the Message Header (i.e. the Standard Header Structure for Proxy Scenarios which I need to send as an input for creating Alerts).
    This message header is automatically populated when I fill it up via message mapping in case of Server Proxy...But for Client Proxy(Async Case)...I am not able to make out......
    The Structure Is:
    SYSTEM_OF_ORIGIN
    SENDER_INTERFACE
    SENDER_NAMESPACE
    MESSAGE_ID
    SENDER_SERVICE
    RECEIVER_INTERFACE
    RECEIVER_NAMESPACE
    RECEIVER_SERVICE
    PROCESS_AREA 
    How can this message header be automatically retrived in the ABAP Code ????
    Please help!!!!!!
    Regards,
    Sriparna

    Hi,
    plz find all header variables, explanations and examples at [SAP help: Querying the XI Message Header|http://help.sap.com/saphelp_nw2004s/helpdata/en/a1/082589fc4246f09793039d5fb01a17/content.htm]
    Regards,
    Udo
    Edited by: Udo Martens on Jul 20, 2010 12:35 PM

Maybe you are looking for

  • Target system(Destination) for RFC call ?

    Need some help in calling an RFC for xi interface. For triggering the data in to xi , RFC needs to be called. This RFC can be called using an ABAP Program / report . BUT inorder to call that RFC a Destination / Target system needs to be defined . Eve

  • HT201263 iTunes doesn't open after I plug in the phone

    After trying to update to ios 7.0.6, iTunes doesn't open after I plug in the phone and doesn't show the message "iTunes has detected an iPhone in recovery mode. You must restore this iPhone before it can be used with iTunes.", which it should. What d

  • 5800 - after today's update the big on screen qwer...

    hi, I just updated my 5800. then I wanted to send someone a text message, but I wasn't able anymore to use the big QWERTY-keyboard! it's gone, and that's very annoying... anyone...?

  • After selecting multiple values, immediately it will placed in Table contro

    hello experts, I m using select-option for multiple value selection. I want:-after selecting multiple values, immediately it will placed in Table control columns which is on same screen of select-option and that columns are grayed out. I'm using this

  • Pro mac slow start up

    My pro mac is slow to start up. It takes about 2-3mins before the log in screen appears. Does anyone know what i can do as i am not very good with computers ?