Meaningless Drivel is fun!
The moose likes Sockets and Internet Protocols and the fly likes Feasible Design For Socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Feasible Design For Socket" Watch "Feasible Design For Socket" New topic

Feasible Design For Socket

Imran Akbar
Ranch Hand

Joined: May 06, 2010
Posts: 63
i'm currently working on a Client tool which connects to an external switch(Server) through Socket connection,

the server behaves like when i post requests from files like A, B, C in order...but the server sends me the responses not in the order which posted, some times i never get response, a request gets posted on a single thread and a separate thread created for reading the response for each request.

so couldn't map which request belongs to the response, and have just one possibility remaining, the first 2-digits of the request will be same in the response too ...

so i generate the first 2-digits and append with the request and i put the File name and the 2-digits ID onto a hashtable, when i get the response back i will map with the first 2-digits and store the response on the selected filename,

i have 100 Possibilities, when request more than 100 comes i need to wait for some secs and remove the Hashmap id's which have not got the response on particular time(need to implement).

is my design safe?, or please suggest me a way forward
I agree. Here's the link:
subject: Feasible Design For Socket
It's not a secret anymore!