printf("InitSocketsStruct: error code = %d ", retcode);
exit(1);
}
while (1) {
printf(">");
gets(cmd_buf);
if (!strncmp(cmd_buf, "conn", 4)) {
retcode = CreateConnection(&sin_addr); /* 建立连接 */
printf("return code: %d ", retcode);
}
else if(!strncmp(cmd_buf, "send", 4)) {
printf("Sockets Number:");
scanf("%d", &sockno1);
retcode = SendPacket(sockno1, buf, 26); /* 发送数据 */
printf("return code: %d ", retcode, sizeof(buf));
}
else if (!strncmp(cmd_buf, "close", 4)) {
printf("Sockets Number:");
scanf("%d", &sockno1);
retcode = CloseConnection(sockno1); /* 关闭连接 */
printf("return code: %d ", retcode);
}
else if (!strncmp(cmd_buf, "quit", 4))
exit(0);
else
putchar(' (出处:清风下载学院)
上一篇:c++中函数重载的相关知识
下一篇:用BCB开发有身份认证功能的Email程序
|