---
title: "STM32F405RGT 사용 하고 있습니다. 아래 소서는 PORT 80 연결 됨니다. 다른 PORT 연결 방법 알고 싶습니다."
url: "https://maker.wiznet.io/forum/15833"
markdown_url: "https://maker.wiznet.io/forum/15833/md"
type: "Forum topic"
category: "MCU & Boards"
author: "crossw8764"
created: "2025-08-12T03:36:35+09:00"
last_activity: "2025-08-12T11:21:59+09:00"
language: "en"
views: 6
replies: 2
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# STM32F405RGT 사용 하고 있습니다. 아래 소서는 PORT 80 연결 됨니다. 다른 PORT 연결 방법 알고 싶습니다.

## Question

Asked by crossw8764 on 2025-08-12 in MCU & Boards.

STM32F405RGT 사용 하고 있습니다. 아래 소서는 PORT 80 연결 됨니다. 다른 PORT 연결 방법 알고 싶습니다.

bool **W5500Init**() {

// Register W5500 callbacks

reg_wizchip_cs_cbfunc(wizchipSelect, wizchipUnselect);

reg_wizchip_spi_cbfunc(wizchipReadByte, wizchipWriteByte);

reg_wizchip_spiburst_cbfunc(wizchipReadBurst, wizchipWriteBurst);

uint8_t rx_tx_buff_sizes[] = {2, 2, 2, 2, 2, 2, 2, 2};

wizchip_init(rx_tx_buff_sizes, rx_tx_buff_sizes);

// set MAC address before using DHCP

setSHAR(net_info.mac);

DHCP_init(DHCP_SOCKET, dhcp_buffer);

reg_dhcp_cbfunc(

Callback_IPAssigned,

Callback_IPAssigned,

Callback_IPConflict

);

uint32_t ctr = 10000;

**while**((!ip_assigned) && (ctr > 0)) {

DHCP_run();

ctr--;

}

**if**(!ip_assigned) {

**return** 0;

}

getIPfromDHCP(net_info.ip);

getGWfromDHCP(net_info.gw);

getSNfromDHCP(net_info.sn);

// Usart1_Send_Run = 1;

// char charData[200]; // Data holder

**sprintf**(charData,"IP: %d.%d.%d.%d\r\nGW: %d.%d.%d.%d\r\nNet: %d.%d.%d.%d\r\n",

net_info.ip[0], net_info.ip[1], net_info.ip[2], net_info.ip[3],

net_info.gw[0], net_info.gw[1], net_info.gw[2], net_info.gw[3],

net_info.sn[0], net_info.sn[1], net_info.sn[2], net_info.sn[3]

);

// Usart1_Send_Run = 1;

// HAL_UART_Transmit(&huart1,(uint8_t *)charData,strlen(charData),1000);

HAL_UART_Transmit_DMA(&huart1,(uint8_t *)charData,**strlen**(charData));

wizchip_setnetinfo(&net_info);

**return** 1;

}

int main(void){

**while**( W5500Init() == 0){ } 정상 연결 반복 으로 연결 합니다.

}

## Replies

### Reply 1 by crossw8764, 2025-08-12

어떤 위치에 적용 해야 하는지 아무리 해도 80 포트 왜 적용 이 안돼요

socket(0, Sn_MR_TCP, 8080, 0); // 소켓 0번, TCP 모드, 포트 8080
listen(0); // 연결 대기

변경은 안되고 계속 80 포트 입니다

버퍼 변경 하지 못 하고 있습니다

내용은:

reg_httpServer_webContent((uint8_t *)"ledon.html", (uint8_t *)index_page_A); // 비정상 동작 안됨
reg_httpServer_webContent((uint8_t *)"wndex.html", (uint8_t *)index_page); //정상동작 합니다.

switch (p_http_request->METHOD)
{
case METHOD_ERR : http_status = STATUS_BAD_REQ;
send_http_response_header(s, 0, 0, http_status);
break;

case METHOD_HEAD :
case METHOD_GET :

get_http_uri_name(p_http_request->URI, uri_buf);
uri_name_A = uri_buf;

if (!strcmp((char *)uri_name_A, "ledon.html")){strcpy((char *)uri_name_A, "ledon.html"); } //동작 안됨니다.
if (!strcmp((char *)uri_name_A, "wndex.html")){strcpy((char *)uri_name_A, "wndex.html"); } //정상 동작 합니다.

아무리 원인 분석 했지만 알수 없습니다.

동일 내용이 동작 안돼요.

현 : 원인 추적은 버퍼 용량 초가 인것 같다는 추척 입니다.

감사 합니다.

우병탁 올림 010-2187-9447 crossw@naver.com crossw8764@gmail.com

### Reply 2 by Aimee0, 2025-08-12 (in reply to reply 1)

wizchip_setnetinfo 가 끝난 후에 socket을 열어 사용하시면 됩니다.

http 관련 코드 없이 기본적인 socket, listen, 등과 같은 함수만 사용하여도 포트가 변경되지 않는지 확인해보시면 좋을 것 같습니다.

해당 예제 참고하실 수 있습니다.

[https://github.com/wiznetindia/W5500-WebServer-with-STM32/tree/master/WebServer(W5500%2BSTM32F411RE)](https://github.com/wiznetindia/W5500-WebServer-with-STM32/tree/master/WebServer%28W5500%2BSTM32F411RE%29)

---

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