java - Android -- Open multiple Sockets (Input and Output Streams) for one connection -


i can connect through bluetooth nexus 1 android phone bluetooth android phone. can use input , output streams connection , write requests , read responses . application uses real time data processing. wondering there way open 2 input/output streams on different sockets (sort of dedicated sockets) communication? , if yes how accomplish ? pointers helpful ...

mmsocket.connect();

public void connect () since: api level 5 attempt connect remote device.

this method block until connection made or connection fails. if method returns without exception socket connected.

creating new connections remote bluetooth devices should not attempted while device discovery in progress. device discovery heavyweight procedure on bluetooth adapter , slow device connection. use canceldiscovery() cancel ongoing discovery. discovery not managed activity, run system service, application should call canceldiscovery() if did not directly request discovery, sure.

now question : how can connect using 2 sockets ... because function above uses socket connect ... , after connection disconnects other attempt socket ????

it of course possible, guessing use blocking calls sockets, need more 1 thread useful work in real time. means need bit of synchronization between threads if communicate.

your'e question frankly bit vague, don't think answers unless qualify bit: want do? why need more 1 socket? second socket for?


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -