fixed bug: close sock when connect fail.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2287 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
wuyangyong 2012-09-10 14:01:30 +00:00
parent 7ce935b601
commit 8d4d8a8338
1 changed files with 68 additions and 67 deletions

View File

@ -44,7 +44,8 @@ void tcpclient(const char* url, int port)
if (connect(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1)
{
/* 连接失败 */
rt_kprintf("Connect error\n");
rt_kprintf("Connect fail!\n");
lwip_close(sock);
/*释放接收缓冲 */
rt_free(recv_data);