当前位置: 技术问答>linux和unix
给我看个错误啊,多谢了,急啊
来源: 互联网 发布时间:2015-12-10
本文导语: 源码: #include #include #include #include #include #include #define DATA "half a league,half a league..." main(argc, argv) { int sock; struct sockaddr_in server; struct hostent *hp,* gethostbyname(); char buf[1024]; /* 建立套接字 */ sock = sock...
源码:
#include
#include
#include
#include
#include
#include
#define DATA "half a league,half a league..."
main(argc, argv)
{
int sock;
struct sockaddr_in server;
struct hostent *hp,* gethostbyname();
char buf[1024];
/* 建立套接字 */
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock h_addr, hp->h_length);
server.sin_port = htons(argv[2]);
if (connect(sock, (struct sockaddr*)&server, sizeof(server))
#include
#include
#include
#include
#include
#include
#define DATA "half a league,half a league..."
main(argc, argv)
{
int sock;
struct sockaddr_in server;
struct hostent *hp,* gethostbyname();
char buf[1024];
/* 建立套接字 */
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock h_addr, hp->h_length);
server.sin_port = htons(argv[2]);
if (connect(sock, (struct sockaddr*)&server, sizeof(server))