Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In my application i want to share file between a server and client, for that purpose i want to create two socket connection in one thread. For example at server we have thread "T" and it has opened two socket like "1234" and socket no "3456" now on the client thread "T2" i will try to connect with these sockets. So how i should implement it.

server:

thread 
{
wait at socket "1234"
wait at socket "3456"
}

CLIENT SIDE:

Thread 
{
connect with socket no "1234"
connect with socket no "3456"
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
159 views
Welcome To Ask or Share your Answers For Others

1 Answer

if you have well implemented protocol(ie. each socket will send the data in a definite order), yeah one thread should work. but you can do this using only one socket connection too. what is the main point of creating two sockets? and what is the relation with android?

in addition; you definitely have to elaborate your question, otherwise it seems the question will be closed soon.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...