---
title: "Socket.c 파일에서 send() 함수 오류"
url: "https://maker.wiznet.io/forum/10428"
markdown_url: "https://maker.wiznet.io/forum/10428/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "page365"
created: "2014-08-05T06:09:46+09:00"
last_activity: "2017-05-04T08:33:36+09:00"
language: "en"
views: 805
replies: 1
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# Socket.c 파일에서 send() 함수 오류

## Question

Asked by page365 on 2014-08-05 in Ethernet Chips.

socket.c 파일에서 send() 함수의 내용중 주석 처리한 부분을 다음과 같이 고치는게 맞지 않나요?

uint16 send(SOCKET s, const uint8 * buf, uint16 len, int retry)
{
…

// if(ret != 0) // error code
// 2013-07-30 wiznet fix the code to add condition “retry”
if(retry || ret != 0)
{
txrd_before_send = IINCHIP_READ(Sn_TX_RD0(s));
txrd_before_send = (txrd_before_send &lt;&lt; 8) + IINCHIP_READ(Sn_TX_RD0(s) + 1);

```
	IINCHIP_WRITE(Sn_CR(s),Sn_CR_SEND);

	/* wait to process the command... */
	while( IINCHIP_READ(Sn_CR(s)) );

	while ( (IINCHIP_READ(Sn_IR(s)) & Sn_IR_SEND_OK) != Sn_IR_SEND_OK )
            {
```

[color=#FF0000] // 
// 다음 if 함수 내 조건문 오류 같다…
// if(IINCHIP_READ(Sn_IR(s)) == SOCK_CLOSED)
if( (IINCHIP_READ(Sn_IR(s)) & Sn_IR_DISCON) == Sn_IR_DISCON)
// [/color]
…

## Replies

### Reply 1 by hjjeon0608, 2014-08-12

안녕하세요

지적하신 부분이 잘못 되어있는 것 같습니다.

고치신 대로 사용하는 것도 가능하나

if(IINCHIP_READ(Sn_[color=#FF4000]SR/color) == SOCK_CLOSED)

이 방식으로 사용하시는 것을 추천 드립니다.

감사합니다.

---

Source: https://maker.wiznet.io/forum/10428
