• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

chat server

 
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI
i've made a chat server which works in the following way :-
1) The server runs on a specific port on aaa.com
2) The client connects to the server. The server returns the port and IP of the connected client to the client and also stores the ip and the port of this client in the database. This is because the client now starts listning for connections(just one ) on that specific port and on the specific IP.
At this stage the link between the client and server closes and the client is now ready to accept just one connection.

3) There is a third interface( i call it external client) through which the actual chatting takes place between the external client and the client ( which is now waiting for the external client to connect to it ). When the client gets connected its ip and port get stored into the database So when this third interface( external client) connects to the database it gets the ip and port of the connected clients which are now listening on specific port ( the port which the actual server retrieves and returns it to the client for it to listen on that port) .
Everything works fine on LAN (locally ) but on the internet it doesn't seem to work .
The prob lies with the connection which the extenal client tries to make to the client which is listening on a specific port ( which is returned by the actual server after retrieving it).
The idea is that the clients which connects to the actual server becomes small servers too so that they can listen for incomming connections(just one for each) and start a conversation.
One more thing . I,am tryig to test this application on the same machine.That is my client ( which connects to the actual server) and the third interface ( external client ) are on the same machine . My external client tries to make a socket on the same IP on which it is running . Could that be a prob . Does a socket has to connect to the remote connection always ? . If yes then my prob could be that i,am running the external client and the client on the same machine.
One last thing . when the client connects to the server, the server returns the port by retriving it from the socket object (by using the accept() ) which is different from the the local port of the client . Locally the client( which also listens for connections) listens on the port given by the server and not the local port and in any case both the local port and the port returned by the server are the same but this is not the case when connecting to the internet.
And yes , the client which connects to the server which also becomes a small server listening for connections starts listening but the the third interface( the external client) is not able to make a Socket connection to the listening client( which is not acting as a small server).
Should i make the client listen on its local port or the port which is returned by the server ( retrieving the port through the Socket obect when the server accepts new connections )
Any suggestions ?
I hope i,am clear enough
Please help me guys. This is urgent
Thanks in advance
[ July 10, 2003: Message edited by: raghav mathur ]
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PLease help me
i,am waiting for a reply
Thanks in advance
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anybody ?
Please ....
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
One more thing . The systems on which i,am testing this application online have already being assinged an IP cos they are on LAN . So is the local IP ( assigned) is conflicting with the IP which is assigned globally when the system connects to the internet.
So when the client which is connected to the server starts listening for a connection then the external client tries to connect to the client(which is listening for connection) by specifying the global IP which is reflected in the database. Now the question is that the client ( which is waiting for the external client to connect ) is listening on the local IP or the GLobal IP ?
PLease help me !
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a similar system and exp the same problem.
My problem is due to the VPN + FW between my server and the internet. So all works fine on the LAN but the server can not open a connection ot the Internet because of the VPN rules. the connection from the client to the server is ok. So I can login but the server does not send any data to the clients.
I posted a message a week ago (C/S communication problem)
Send me an email, lets try to work the issue together.
I use Java 1.4+.
Let me know if u find a solution.
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are 2 situations when my application doesn't work :
1) If the remote client which is listening fot a connection doesn't get pinged from the machine where the external client resides.
2) If the ISP doesn't provide with a global IP.
With regard to the first issue , i want to ask whether it is possible to have a one sided ping . That is if the remote client tries to ping the machine where the external client resides , it does it successfully but doesn't work the other way round .
As far as the second issue is concerned. What can be the solution. If the ISP doesn't provide an IP , then how will the client listen for a connection from the external client ?
One more thing :
I used the following command winipcfg to look for assinged IP's but it did not reflect the IP which should be assinged to me when i connect to the internet. Thoough i come to know about that IP when i actually connect to the server(on aaa.com). The server retrieves the IP which connects to it .That is how i come to know about the IP being assinged to me . But still it doesn't get refleted either by the ipconfig or winipcfg commands.
Could this be a reason that my applicationdoesn't work on the system where there is no assinged IP ?
PLease help me out !
Thanks in advance
[ July 14, 2003: Message edited by: raghav mathur ]
[ July 14, 2003: Message edited by: raghav mathur ]
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody please go through this thread and try helping me out. I have not recieved even one response yet .
When i connect to the internet , i do get an IP but i have not selected "obtain an IP address automatically". So the IP which i've got after connecting doen't get reflected by typing "ipconfig"
IN that case the machine on which the client is expecting an exyernal client to connect to it is not able to listen for a connection !!!
This is what i've figured out uptill now .
How can this issue be resolved ???
PLease ....
PLease guys . Guide me a bit. PLease help me out
Thanks in advance
[ July 15, 2003: Message edited by: raghav mathur ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic