Sending messages between clients
hi,
I want to make small instant messenger,like yahoo.I have made a server which accept connection from different client & send online user list to each and every client connected to the server.
But now i have to send messages between the clients(chatting).
This can be do either through server or allow server establishing connection betwwen two client & allow them to continue chatting session.But i am not able to figure out how i do either of the things using socket programming.
Please help me ,to establish chatting session between the clients.
Thank you for replies
alok
Yes, It should be Non public to Other client but not to server.
Suppose client1 want to send message to client2 then it send message to server,then server passes this message to client2.
Now as client2 got the it send some reply to client1 which
is also reach to client1 through server.But I have problem ,as how
does client2 knows to which client he has send message as no of clients are connected to the server & more then one client has send message to client2.
Basically I have problem in sending reply to a message send by the different client connected to the server.
Thank You for reply
Similar Messages
-
Sending message across clients
Hello,
wanted to know how to send message across clients. Suppose I have 2 XI servers : one is XI other is PI. I want to send message from PI to XI. how will we configure this scenario? what adapters will be used and what is the message flow ?
Thank you.Hi,
Check my thread it may be helpful
XI adapter
Regards,
Prakash -
Send message to client before session invalidated
i am using jsp and java servlet tech. for my web application.
my problem is :
i want to send a message to client before session invalidated.
please help me to find the best way to solve my problem.You can detect session termination by putting an object in the session attributes which implements HttpSessionBindingListener. What you can't do is send a message to a client, basically because all http transactions are initiated by the client. The only way I can see you could do this is to put an applet on your web pages which periodically consults the server concerning the session state.
Then the problem is that there's no obvious way of determining if the session is about to timeout, only whether it has or not. Your applet couldn't return the session cookie (as such) because that would reset the session timeout and the session would never expire. If you could obtain the session without reseting the expiry (perhaps from SessionContext though that's depracated) you could look at getLastAccessedTime() and getMaxInactiveInterval, but I don't know that this can be done. You can't even count, on some systems, on the session remaining in memory.
If you really need to do this you may need to consider implementing sessions for yourself. I've done this for non-webapp based logins and it's not too hard. -
Send message from client problem
Hi all,
i want send some JMS messages from standalone client program to MDB through OC4J JMS service. I wrote little sample client program:
public static void main(String [] args)
throws Exception
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "admin");
env.put(Context.PROVIDER_URL, "ormi://localhost:23791/");
Context context = new InitialContext(env);
QueueConnectionFactory connectionFactory = (QueueConnectionFactory)context.lookup("jms/my/test.queueConnectionFactory");
QueueConnection connection = connectionFactory.createQueueConnection();
QueueSession qSession = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue q = (Queue)context.lookup("jms/my/test.queue");
QueueSender sender = qSession.createSender(q);
connection.start();
TextMessage message = qSession.createTextMessage();
message.setText("Text messaga no.: "+i);
sender.send(message);
sender.close();
qSession.close();
connection.close();
But it throws JMSException:
javax.jms.JMSException: Unable to connect to JMSServer (/127.0.0.1:9127)
at com.evermind.server.jms.EvermindQueueConnection.connect(EvermindQueueConnection.java:144)
at com.evermind.server.jms.EvermindQueueConnection.send(EvermindQueueConnection.java:94)
at com.evermind.server.jms.EvermindQueueSession.send(EvermindQueueSession.java:117)
at com.evermind.server.jms.EvermindQueueSender.send(EvermindQueueSender.java:75)
at com.evermind.server.jms.EvermindQueueSender.send(EvermindQueueSender.java:36)
at com.evermind.server.jms.EvermindQueueSender.send(EvermindQueueSender.java:31)
at SenderClient.main(SenderClient.java:35)
Row 35 is sender.send(message);
And running standalone OC4J (9.0.3) throws exception too:
java.lang.NullPointerException
at com.evermind.server.jms.JMSServer.removeClient(JMSServer.java:724)
at com.evermind.server.jms.JMSRequestHandler.run(JMSRequestHandler.java:278)
at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:66)
All jms.xml stuff is configured properly.
Can someone help me what i do wrong?
Best regards
Radovan SninskyHi radovan,
Check your jdk versions at your server and client. Make sure that your are running your server and client with the same jre. Even i had the same problem when oc4j was started with jdk1.4 jre and running the client using jdk1.3.
Hope this helps
shrini -
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.
NimeshBefore 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. -
ISM-SRE-300 don´t allow send data between clients and pc in LAN
I have an ISM-SRE-300 on cisco 1941 does not allow sending of data between clients attached to an AP wired to PC Networking.
LAN CLIENT= VLAN 20 10.94.4.0 /24
SERVER CLIENTE = 10.94.4.1 D.G= 10.94.4.254
ROUTER
INT G0/0.1= IP UNNUMBERED VLAN 1 NATIVE VLAN
INT G 0/0.20 = IP UNNUMBERED VLAN 20
INT VLAN 1 = 94.4.1.1 /24
INT VLAN 20 = 10.94.4.254 /24
ISM-SRE
MANAGEMENT UNTAGGED 94.4.1.2
VLAN 20 VLAN=20 IP=10.94.4.251 /24 D.G. 10.94.4.254
IF SENDING PING FROM ROUTER TO SERVER=10.94.4.1 IS OK
IF SENDING PING FROM ISM TO SERVER DON´T ANSWER
IF JOIN A CLIENT IN AP, CLIENT WIRELESS=10.94.4.150 /24 D.G. 10.94.4.254
I SEND PING TO ISM 10.94.4.251 IS OK
I SENG PING TO ROUTER 10.94.4.254 DON´T ANSWER
I SEND PING FROM SERVER (10.94.4.1) TO ROUTER 10.94.4.254 IS OK
I SEND PING TO ISM 10.94.4.251 DON´T WORK
I SENG PING TO CLIENT WIRELESS 10.94.4.150 DON´T WORK
CAN ANYONE HELP ME ?
THANKS
JUAN-RAMONJust to be clear, this posting is NOT asking for help. This is a posting to help those with the HARDWARE side of the configuration. This is what I just finished doing in my lab for testing. Worked great. DHCP, WLAN Advertising, etc. I now have to go on to the next harder steps of really combing through the WLC configuration, applying our standard template configurations for our Routers/Switches, applying dual and tertiary redundancy with regards to routing, DHCP via MICROSOFT and not using a switch, and so on.
This was just meant to help those who don't have a lot of experience configuring the router switch environment. Sorry if I confused any one. -
How do I send messages between my iPhone 4s, my daughters iPods and my sons iPad?
How do I send messages via my iPhone 4s and my daughters iPods and my sons iPad? I really want to make the
Most out of our devices.You would need to each have your own apple ids so you can imessage each other
-
How to send message to client?
Hello, I'm newbie in J2EE. I have a client (e.g. GUI class) which have to "connect" to EJB and start further processing when others 3 clients also connect to this EJB. It's not a problem to obtain reference to EJB and connect to it, but I don't know how to send some message from EJB to client.
I've tried to implement it with events, but it not works. Is it possible to use event for this? Are there any patterns to solve this class of problems? Please, help!
Below fragments of my code for events:
GamesListFrame.java
try
title.setText("text");
tablesManager = getHome().create();
tablesManager.addStartGameListener(this);
tablesManager.generateEvent();
} catch ...
}and TablesManagerBean.java
* @ejb.interface-method
* view-type="remote"
public void generateEvent()
EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue();
StartGameEvent event = new StartGameEvent(this);
q.postEvent(event);
* @ejb.interface-method
* view-type="remote"
public void addStartGameListener(StartGameListener listener)
listenerList.add(StartGameListener.class, listener);
public void processEvent(AWTEvent event)
if (event instanceof StartGameEvent)
EventListener[] listeners = listenerList.getListeners(StartGameListener.class);
for (int i=0; i<listeners.length; i++)
((StartGameListener)listeners).GameStarted((StartGameEvent)event);
else
super.processEvent(event);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. -
Help - sending messages between servers
Hy, Am actually trying to send a message from 1 server and try to receive that same message from another server. Am using Jonas server.
I've create an SessionBean from which I send the message from server A.
The function sendMsg () contains the following:
try
prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");
prop.put(Context.PROVIDER_URL, "rmi://serverB:1099");
ictx = new InitialContext(prop);
qcf = (QueueConnectionFactory)ictx.lookup("JQCF");
queue = (Queue)ictx.lookup("OutQueue");
I have already deployed my ejb jar on the 2 servers.
But when I send the msg from server A , I receive the msg from the server A itself instead on server B
Could you please help me solved my problem
thanks in advanceHy,
Excuse me. I was wrong. I did not receive the msg.
I have made the test again.
I have created 2 jar. The first one contains only the sender (client and session bean ) + deployment descriptor and the jar contains only the MDB + deployment descriptor.
But I do not receive any msg
what should I do more?
thanks in advance -
TS2755 How can I send messages between one iPod to another iPod?
I need help trying to send a message from one iPod to another using the messaging.
There are some apps that will let you send photos from one iOS device to another over BT.
-
Sending object between client server with some class without serializable
Hi friend,
I need to send the object from server to client via ObjectInputStream and ObjectOutputStream, however, in these objects, some are implements by others, no source code provided, which haven't implement serizlizable, so does anyone can tell me what I can do?
Thanks your concern.
Cheers,
AlvaAnyone can help? It is urgent!
Thanks,
Alva -
How to send message from Message Driven Bean to JMS client?
In my project I have JMS client, two QueueConnectionFactory and Message Driven Bean. Client send message to MDB through the first QueueConnectionFactory , in one's turn MDB send message to client through the second Queue Connection Factory . I already config my Sun AppServer for sending message in one way, and sending message from MDB to the second QueueConnectionFactory. But on my Client there is an error : �JNDI lookup failed: javax.naming.NameNotFoundException: No object bound to name java:comp/env/jms/MyQueue2� (jms/MyQueue2 � this is the name of my Queue). So it couldn't get this message.
P.S.
Thank you for help!!!What is the name of the second queue?is the connection factory on the local?Yes the connection factory is on the local. The name of my first queue is jms/MYQueue and the name of another one is jms/MyQueue2.
-
hello, first sorry for my english.
i' m developing a multyplayer games whith multi-rooms
application.onAppStart = function(){
application.player_so = SharedObject.get("player_so",
false);
application.nextId = 0;
application.onConnect = function(newClient,name){
application.nextId++
newClient.id = application.nextId
application.player_so.setPrope rty(newClient.name, name);
application.acceptConnection(newClient);
newClient.sendMessage = function(testo) { ;
for(var c=0; c<application.clients.length;c++) { ; ;
application.clients[c].call("sendMessage", null,"hello i'm:
"+name);
ok.. i have 10 rooms .. then the client
var client_nc:NetConnection= new NetConnection();
client_nc.connect("rtmp:/myapplication/room1","ciao");
// i create 10 room
client_nc.onStatus = function(info) {
client_nc.sendMessage = function(msg) {
dbg_txt.text +="Debug: "+ msg+"\n";
dbg_txt.scroll += 1;
dbg_txt.scroll = dbg_txt.maxscroll;
mybutton.onRelease= function(){
_root.client_nc.call("sendMessage", null,
_root.testo_txt.text );
how can i send a message for all client?
if i send a message this message is received only clients of
a determinate room, i want send message for client of all
roomAs I said the problem is in delta pull mechanism. Talk to your Basis or EP guy and check the following link
http://help.sap.com/erp2005_ehp_03/helpdata/EN/eb/101fa0a53244deb955f6f91929e400/content.htm
Regards, IA -
Hello,
in my message bean i have method with 3 BigDecimal parameters.
How can i send message from client with 3 BigDecimal parameters?
thanks for help.No, but you can. use an object stream to serialize the message and you are
all set.
_sjz.
"deezh" <[email protected]> wrote in message
news:3d23fdbf$[email protected]..
>
>
-
Hello,
Am working on an Adobe AIR application.See i have two type of users in my application ,"nurses and patients".I jus create the UI ie,both of them have a login and register pages..when both of them get logged in they have there own home pages..In their home page they have a buttons "compose new message"..both of them could send messages between them.wen patient send a message,nurse will get an alert about that message(i mean alert inside the app..not like SMS).Actually..this is a mobile application ie mobile to mobile transactions are goin to happen..
THis application is goin to run on smartphones..
My question is:
1.How can i do this messaging part?Am new to AIR applications..so i have no idea about this..please help anybody..
ThanksHave you looked at posting in the Adobe support forums?
Maybe you are looking for
-
Smartforms output as HTML in email
Hi, I want to send the output of a smartform as html in email body. I found and used this bolg: :<a href="/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp HTML Email from SAP CRM/ERP</a> I did everything as per the blog. Howev
-
Any way I attempt to open new tabs, be it clicking on the new tab button or using the short-cut Ctrl-t, I am unable to open any new tabs on my browser window. The only way I have found that I can open a new tab is to right-click on a link and instruc
-
My USA purchased iPhone 4S factory unlock is not working in India as it gets no signal bars
Hi, I got my iPhone 4S from USA, which came with AT&T sim in it. It was sold as factory unlocked but when I inserted Indian sim card in it , there appeared the name of the service provider but no signals. Can anybody help as what best can be done to
-
Export audio to video AAC not working in Logic Pro X
Hi Anyone else have this. When I choose to export audio to movie, and select AAC, it exports but when I chack the file, it has actally used PCM. Regards Keef
-
Error: "Function or method not supported." when using RF List Mode on NI 5673E
Hi, I am trying to use the RF List Mode in NI RFSG 5673E. I tried running the sample code "RFSG Configuration List Frequency and Power Sweep.vi" but an error would show up: "Error: niRFSGCreateConfigurationList.VI <ERR> The LO reported the following