text encoding fixed
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "stdafx.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
/* Forwards */
|
||||
void socket_lingeron(socket_t s);
|
||||
@@ -26,7 +26,7 @@ int socket_read(socket_t desc, char* read_point, size_t space_left)
|
||||
if (ret > 0)
|
||||
return ret;
|
||||
|
||||
if (ret == 0) // 정상적으로 접속 끊김
|
||||
if (ret == 0) // 정상적으로 접속 끊김
|
||||
return -1;
|
||||
|
||||
#ifdef EINTR /* Interrupted system call - various platforms */
|
||||
@@ -66,7 +66,7 @@ int socket_write_tcp(socket_t desc, const char *txt, int length)
|
||||
{
|
||||
int bytes_written = send(desc, txt, length, 0);
|
||||
|
||||
// 성공
|
||||
// 성공
|
||||
if (bytes_written > 0)
|
||||
return (bytes_written);
|
||||
|
||||
@@ -119,7 +119,7 @@ int socket_write(socket_t desc, const char *data, size_t length)
|
||||
if (errno == EAGAIN)
|
||||
sys_err("socket write would block, about to close!");
|
||||
else
|
||||
sys_err("write to desc error"); // '보통' 상대편으로 부터 접속이 끊긴 것이다.
|
||||
sys_err("write to desc error"); // '보통' 상대편으로 부터 접속이 끊긴 것이다.
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -162,8 +162,8 @@ int socket_bind(const char * ip, int port, int protocol)
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sin_family = AF_INET;
|
||||
//윈도우 서버는 개발용으로만 쓰기 때문에 BIND ip를 INADDR_ANY로 고정
|
||||
//(테스트의 편의성을 위해)
|
||||
//윈도우 서버는 개발용으로만 쓰기 때문에 BIND ip를 INADDR_ANY로 고정
|
||||
//(테스트의 편의성을 위해)
|
||||
#ifndef OS_WINDOWS
|
||||
sa.sin_addr.s_addr = inet_addr(ip);
|
||||
#else
|
||||
@@ -240,7 +240,7 @@ socket_t socket_connect(const char* host, WORD port)
|
||||
struct sockaddr_in server_addr;
|
||||
int rslt;
|
||||
|
||||
/* 소켓주소 구조체 초기화 */
|
||||
/* 소켓주소 구조체 초기화 */
|
||||
memset(&server_addr, 0, sizeof(server_addr));
|
||||
|
||||
if (isdigit(*host))
|
||||
@@ -273,7 +273,7 @@ socket_t socket_connect(const char* host, WORD port)
|
||||
socket_timeout(s, 10, 0);
|
||||
socket_lingeron(s);
|
||||
|
||||
/* 연결요청 */
|
||||
/* 연결요청 */
|
||||
if ((rslt = connect(s, (struct sockaddr *) &server_addr, sizeof(server_addr))) < 0)
|
||||
{
|
||||
socket_close(s);
|
||||
|
||||
Reference in New Issue
Block a user