Interface 10月号に掲載したプログラムの修正について
CQ出版社のInterface 10月号 特集 第7章,Interfaceのダウンロードページに掲載しましたプログラム p2pq_ad に問題がありました.
- 実行中, q キーを押しても終了できません.
- SendTo 文の構文が間違っています.ただし,プログラム自体は動作します.
お手数ですが,次のようにプログラムを修正していただきますようお願いいたします.
| 掲載したプログラム p2pq_ad | 修正したプログラム p2pq_ad |
|---|---|
udpsend(char *str, int port) {
char soc, *buf, len;
int i, j;
long ip;
ip = GetIP(str);
soc = CreateSocket(0);
if ((soc <= -1) || (ip == 0)) {
PrStr("Invaid Socket");
CloseSocket(soc);
return;
}
PrStr("Start UDP Send\r\n");
buf = MemoryAlloc(20);
InitAd(0x70);
while (1) {
len = 0;
MemClear(buf, 20);
for(i = 4; i < 7; i++){
GetDigit(GetAd(i), buf+len);
len += StrLen(buf+len);
if (i != 6) buf[len++] = 44;
}
SendTo(soc, ip, port, buf, StrLen(buf);
if (Getc(0) == 'q') break;
}
PrStr("End UDP Send\r\n");
CloseSocket(soc);
MemoryFree(buf);
}
|
udpsend(char *str, int port) {
char soc, *buf, len;
int i, j;
long ip;
ip = GetIP(str);
soc = CreateSocket(0);
if ((soc <= -1) || (ip == 0)) {
PrStr("Invaid Socket");
CloseSocket(soc);
return;
}
PrStr("Start UDP Send\r\n");
buf = MemoryAlloc(20);
InitAd(0x70);
#stop 0
while (1) {
len = 0;
MemClear(buf, 20);
for(i = 4; i < 7; i++){
GetDigit(GetAd(i), buf+len);
len += StrLen(buf+len);
if (i != 6) buf[len++] = 44;
}
SendTo(soc, ip, port, buf, StrLen(buf));
if (Getc(0) == 'q') break;
}
PrStr("End UDP Send\r\n");
CloseSocket(soc);
MemoryFree(buf);
}
|
バグレポートありがとうございました: 【P2P】 P2P地震情報 【地震情報】(レス番4,14)