0

ローカル マシンで動作する処理プログラムがあります。ローカルの udp ポートからデータを読み取り、このデータを使用して画面に円を描画します。それはうまくいくので、素晴らしいです。

しかし、本番環境では、プログラムを別のコンピューターで実行する必要があります。そして、私はそれを機能させることができません。処理中に次のエラー メッセージが表示されます。

opening socket failed!
> address:192.168.1.118, port:6666 [group:null]
> Cannot assign requested address: Cannot bind

もちろん、IP アドレスを確認しましたが、ローカル マシンで正常に動作するので問題ありません。UDP部分のコードは次のとおりです。

// import UDP library
import hypermedia.net.*;

String HOST_IP = "192.168.1.118";
UDP udp;  // define the UDP object

// get an array ready 
int num = 20;
int[] xx = new int[num];
int[] yy = new int[num];


void setup() {
size(1024, 768);
smooth();
//noStroke();

// create a new datagram connection on port 6666
udp = new UDP(this, 6666, HOST_IP);
udp.listen( true );
}



//process events
void draw() {;}
/**
* To perform any action on datagram reception, you need to implement this 
* handler in your code. This method will be automatically called by the UDP 
* object each time he receive a nonnull message.
* By default, this method have just one argument (the received message as 
* byte[] array), but in addition, two arguments (representing in order the 
* sender IP address and his port) can be set like below.
*/
// void receive( byte[] data ) {       // <-- default handler
void receive( byte[] data ) {  

background(255);

// get the "real" message =
// forget the ";\n" at the end <-- !!! only for a communication with Pd !!!

 data = subset(data, 0, data.length-2);
String message = new String( data );

// print the result
println(message );

両方のマシンで Windows XP を使用しており、スイッチと udp ケーブルを介して接続されています。

トラブルシューティングを開始する場所と方法がわかりません。何か案は?

4

0 に答える 0