データの連続ストリームを受信する Android アプリケーションを作成しています。次のようにランナブル内で接続を設定しました。
Runnable runnable = new Runnable()
{
public void run()
{
ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket subscriber = context.socket(ZMQ.SUB);
subscriber.connect("tcp://[IP]:[Port]");
TextView strDisplay = (TextView) findViewById(R.id.stringDisplay);
while (!Thread.currentThread ().isInterrupted ())
{
// Read message contents
Log.i("Output", "the while loop ran up to here");
//*HANGS ON THE LINE BELOW*
String testcase = subscriber.recvStr(0);
strDisplay.setText(testcase);
Log.i("Output", "The while loop completed");
}
さて、インターウェブを精査した結果、2 つの結論に達しました。
1) recvStr() は、何かを受信するまで待機するブロッキング呼び出しです。つまり、正しく接続されていないか、何か他のものです
と
2) 何らかのフィルターを設定する必要があるかもしれません。
次に何をすればいいのかわかりません。JeroMQ または Android サーバー アクセスの経験がある方からの助けをお待ちしております。