1 |
/* |
/* |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Protocol services - TCP layer |
Protocol services - TCP layer |
4 |
Copyright (C) Matthew Chapman 1999-2000 |
Copyright (C) Matthew Chapman 1999-2001 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
60 |
|
|
61 |
if (sent <= 0) |
if (sent <= 0) |
62 |
{ |
{ |
63 |
STATUS("write: %s\n", strerror(errno)); |
error("write: %s\n", strerror(errno)); |
64 |
return; |
return; |
65 |
} |
} |
66 |
|
|
101 |
|
|
102 |
if (rcvd <= 0) |
if (rcvd <= 0) |
103 |
{ |
{ |
104 |
STATUS("read: %s\n", strerror(errno)); |
error("read: %s\n", strerror(errno)); |
105 |
return NULL; |
return NULL; |
106 |
} |
} |
107 |
|
|
128 |
} |
} |
129 |
else if (!(servaddr.sin_addr.s_addr = inet_addr(server))) |
else if (!(servaddr.sin_addr.s_addr = inet_addr(server))) |
130 |
{ |
{ |
131 |
STATUS("%s: unable to resolve host\n", server); |
error("%s: unable to resolve host\n", server); |
132 |
return False; |
return False; |
133 |
} |
} |
134 |
|
|
135 |
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) |
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) |
136 |
{ |
{ |
137 |
STATUS("socket: %s\n", strerror(errno)); |
error("socket: %s\n", strerror(errno)); |
138 |
return False; |
return False; |
139 |
} |
} |
140 |
|
|
145 |
(sock, (struct sockaddr *) &servaddr, |
(sock, (struct sockaddr *) &servaddr, |
146 |
sizeof(struct sockaddr)) < 0) |
sizeof(struct sockaddr)) < 0) |
147 |
{ |
{ |
148 |
STATUS("connect: %s\n", strerror(errno)); |
error("connect: %s\n", strerror(errno)); |
149 |
close(sock); |
close(sock); |
150 |
return False; |
return False; |
151 |
} |
} |