Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Feasible Design For Socket

 
Imran Akbar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic