cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an example of TCP/IP netconn client?

CHan.2
Associate II

ip4_addr_t remote_ip;

struct netconn *clientConn;

IP4_ADDR(&remote_ip, 192, 168, 0, 11);

clientConn = netconn_new(NETCONN_TCP);

if(clientConn != NULL)

{

conn_err = netconn_connect(clientConn, &remote_ip, 8789);

if(conn_err == ERR_OK)

{

netconn_write(clientConn, message, 22, NETCONN_NOFLAG); 

}

}

netconn_close(clientConn);

netconn_delete(clientConn);

osDelay(10);

Ping works, TCP/IP Server also works, but the Client returns ERR_ABRT from the netconnect function.

Since the netconn API Server code worked without any problems, I think there will be no problems with hardware and settings.

So I'm looking for an example to refer to.

I found examples of non-netconn APIs and examples of netconn API Server, but I don't think there are examples of netconn API Clients. (I've seen a few, but they look the same as the code above.)

1 ACCEPTED SOLUTION

Accepted Solutions
CHan.2
Associate II

This issue has been resolved. I tested it with a Hercules file associated with my PC, but it was a problem because I didn't set an inbound rule.

View solution in original post

2 REPLIES 2
CHan.2
Associate II

The chip I use is H743VI.

CHan.2
Associate II

This issue has been resolved. I tested it with a Hercules file associated with my PC, but it was a problem because I didn't set an inbound rule.