IT
genericClient
kio467
2014. 11. 23. 21:24
// 컴파일 할때 아래의 socklib파일을 함께 해야합니다.
// gcc genericClient.c. socklib.c -o genericClient
#include <stdio.h>
#define LEN 256
#define host "***.***.***.***" // 뭐든 호스트를 입력하세요. 이대로는 안됩니다 ㅋ
#define port 13003
main()
{
int fd;
fd = connect_to_server(host, port);
if (fd == -1)
exit(1);
talk_with_server(fd);
close(fd);
}
talk_with_server(fd)
{
char buf[LEN];
int n;
n = read(fd, buf, LEN);
write(1, buf, n);
}