Results 1 to 13 of 13
Thread: Regarding server sockets
- 04-14-2012, 10:42 AM #1
Member
- Join Date
- Apr 2012
- Posts
- 7
- Rep Power
- 0
Regarding server sockets
I am creating a chat application in which server can provide Relay Chat as well as instant messaging. i have finished the relay chat part. My application can also generate list of users that are logged in on server side. I am using objectoutputstream to send that list but my server is getting disconnected. i am sending on same socket which serversocket.accept() method spawns which sends my messages too..
my question is can a two server sockets can be opened at the same time on a single ip but different ports... coz i tried doing tht and still connection is getting reset i am doing this on localhost...
- 04-14-2012, 01:00 PM #2
Re: Regarding server sockets
Have you tried it? You should be able to use ServerSockets with different ports with no problems.
If you don't understand my response, don't ignore it, ask a question.
- 04-14-2012, 08:47 PM #3
Member
- Join Date
- Apr 2012
- Posts
- 7
- Rep Power
- 0
Re: Regarding server sockets
Thanks dude
i was doing a very silly mistake while serializing objects
and your answer is correct..gif)
.gif)
i just wrote a statement that prints all the connections serversocket accepts
finally the list of users is getting transported
THANK YOU SO MUCH....
- 04-14-2012, 08:59 PM #4
Re: Regarding server sockets
Often just trying it will give you the answer saving a post.
If you don't understand my response, don't ignore it, ask a question.
- 04-22-2012, 08:04 AM #5
Member
- Join Date
- Apr 2012
- Posts
- 7
- Rep Power
- 0
Re: Regarding server sockets
Ok i got one more glitch. see there is a list of clients which is getting populated once a client is connecting or disconnecting to the server this list is stored in a string array which is then sent to other users by means of object serialization and objectoutput stream. the thing is i m not closing the this stream and object is sent only once that is the list is sent only once .
my question is do u have to close the objectoutput stream every time ?? how to read the list if we r not closin the output stream ?? and i dont know whether object is being recieved multiple times.....
plz help
- 04-22-2012, 01:12 PM #6
Re: Regarding server sockets
You would close the stream when you are done with it. If you want to continue using it, try calling flush().
If you send it once, you should receive it once. Why do you think it might be receiving it multiple times?i dont know whether object is being recieved multiple times.....If you don't understand my response, don't ignore it, ask a question.
- 04-22-2012, 07:05 PM #7
Member
- Join Date
- Apr 2012
- Posts
- 7
- Rep Power
- 0
Re: Regarding server sockets
The list is getting updated every time and is getting stored in the string array then serialized array is sent many times over the socket i m using flush() after sending the array its the receiving i m having problem with ....
the array is sent properly for the first time but when another client connects to the server the list gets updated and is sent again i don't know whether the array is sent again or whether m having problem in the receiving end.
so again ma question is can one use the stream more than once for sending the serialized object..
sorry for asking u silly questions but i m not getting this for a while and its one module of ma engineering project and i m about to get ma final degree and super tensed ...
- 04-22-2012, 07:15 PM #8
Re: Regarding server sockets
There shouldn't be any restrictions on what is sent or how often it is sent over a stream.can one use the stream more than once for sending the serialized object..
Do some debugging. Print out what is sent and what is received.i don't know whether the array is sent again or whether m having problem in the receiving end.If you don't understand my response, don't ignore it, ask a question.
- 04-29-2012, 05:08 PM #9
Member
- Join Date
- Apr 2012
- Posts
- 7
- Rep Power
- 0
Re: Regarding server sockets
I completed the chat client i was doing a mistake while reading later i had to use oos.reset() now i m facing a problem regarding swings
norm dude u rock
can u plz help me in this i m kinda in a very bad position
i was integrating all the modules for UI
now i m facing a problem where i spawn a main window and text area is updated from other class problem is am the output stream of the client side is getting closed after first instance
n i ll mail u da code of ma project if u ll plz help me i m having a deadline to dayafter tommorow....
- 04-29-2012, 05:10 PM #10
Re: Regarding server sockets
Please use normal English in your posts.
Waiting for a properly spelled post.If you don't understand my response, don't ignore it, ask a question.
- 04-29-2012, 05:18 PM #11
Member
- Join Date
- Apr 2012
- Posts
- 7
- Rep Power
- 0
Re: Regarding server sockets
Ok.
Sorry i am kinda weak at phrasing sentences in english
see i have 4 modules of my project
one of them is chat which deals with relaychat as well as private messaging
I have completed this module and gave it a temporary GUI using swings
Now when i am integrating it with the applications UI i am facing a problem
can i mail u the code so u can look into it ll be better to explain what problem i am facing .. and we can chat via gtalk or something...
- 04-29-2012, 05:23 PM #12
Re: Regarding server sockets
Sorry, no private work. Post what you want to discuss here. Make a small, simple program that compiles, executes and shows the problem.
If you don't understand my response, don't ignore it, ask a question.
- 04-29-2012, 05:28 PM #13
Member
- Join Date
- Apr 2012
- Posts
- 7
- Rep Power
- 0
Similar Threads
-
Server Sockets sending images from URL
By devett in forum NetworkingReplies: 1Last Post: 06-07-2011, 07:25 AM -
Client and Server sockets on same machine
By Yogesh_P in forum NetworkingReplies: 3Last Post: 03-28-2011, 04:10 PM -
Java Server & C# client communicating through sockets
By yukijocelyn in forum NetworkingReplies: 0Last Post: 09-05-2008, 10:05 PM -
An echo server using UDP sockets
By Java Tip in forum java.netReplies: 0Last Post: 04-07-2008, 08:09 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks