---
title: "STM32 F401 / HTTP Client / GET requests / How to avoid open-close-openclose socket"
url: "https://maker.wiznet.io/forum/14364"
markdown_url: "https://maker.wiznet.io/forum/14364/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "Gurom"
created: "2021-10-17T19:51:54+09:00"
last_activity: "2024-02-05T06:19:10+09:00"
language: "en"
views: 1234
replies: 8
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# STM32 F401 / HTTP Client / GET requests / How to avoid open-close-openclose socket

## Question

Asked by Gurom on 2021-10-17 in Ethernet Chips.

Hi frinds!

I use the GET requests to the server.
I don’t like my code. My code is working but…
If I need to send the GET requests 3 times then I do:

– create socket
– Send GET
– recieve answer
– close socket

– create socket
– Send GET
– recieve answer
– close socket

– create socket
– Send GET
– recieve answer
– close socket

I want to open the socket for many GETs requests. How to do it?

Please see my code in attached file. I indicated the part which must work 1 time only.

[![Screenshot_20211017_224551](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/5/5382ece7b1da6a969cc03bd74e428c9fce458494.png) Screenshot_20211017_224551995×902 162 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/5/5382ece7b1da6a969cc03bd74e428c9fce458494.png)

## Replies

### Reply 1 by louis, 2021-10-18

Hello.

1. Which product are you using?

2. Do you want to open multiple sockets?

Thank you. I’ll answer that.

### Reply 2 by Gurom, 2021-10-18

Hello

1. I use w5500

2. I don’t know. Please help. I need to send biq q-ty GET requests to one server. Do you recomend multiple sockets?

### Reply 3 by louis, 2021-10-18 (in reply to reply 2)

What does big q-ty mean?
Do I have to create sockets and send the data?

I’m curious what you’re trying to make it with.

Thank you.

### Reply 4 by Gurom, 2021-10-18

Hi Louis!

I will explain you shortly.

Now I use algorithm:
Open socket / Send GET / Close socket + Open socket / Send GET / Close socket

I want to use the following algorithm:
Open socket / Send GET + Send GET + Send GET / Close socket

### Reply 5 by louis, 2021-10-19

I will attach the example of **LoopBack**.

![](https://github.githubassets.com/favicons/favicon.svg) [GitHub](https://github.com/WIZnet-ioLibrary/W5x00_Loopback_with_W5100S_EVB)

![](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/f/f20f1ee2f3490dd8c959f4ca8252b7d6b4d77711.png)

### [GitHub - WIZnet-ioLibrary/W5x00_Loopback_with_W5100S_EVB: This Project is...](https://github.com/WIZnet-ioLibrary/W5x00_Loopback_with_W5100S_EVB)

This Project is base on W5100S-EVB. but If you use the SPI of Arduino interface on W5100S-EVB, you can use the W5100S/W5100/W5200/W5500 when wizchip_conf.h modify - GitHub - WIZnet-ioLibrary/W5x00_...

In the example, there is content SOCKET opens, closes, and sends data.

I think you can modify it according to your algorithm.

Thank you,

### Reply 6 by alifsayawais, 2022-04-14

Hi Gurom, Can you please provide me the full code?
Thanks

### Reply 7 by oguzkagan001, 2023-08-02

Hi Gurom.
Can you send the full code? Thanks already.

### Reply 8 by mrkam, 2024-02-05

Hi Gurom. Can you please send the full code?

---

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