问题
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"
}
回答1:
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.
来源:https://stackoverflow.com/questions/15311029/create-two-socket-connection-in-one-thread