chipKIT® Development Platform

Inspired by Arduino™

Assiging static IP to TCPechoclient (chipkit network shield)

Created Thu, 17 Dec 2020 12:02:26 +0000 by sundar@19


Thu, 17 Dec 2020 12:02:26 +0000

Hi, I am using chipkit network shield and using TCPechoclient example. I am going to use my laptop (Linux PC) as server and the chipkit as client. But

// use DHCP to get our IP and network addresses

This line assigns dynamic IP to my chipkit. Since I am going to connect my chipkit directly to my laptop (not router) thru an ethernet cable , I want to assign it a static IP and use it as client. Is this possible?


Thu, 17 Dec 2020 15:07:43 +0000

There are other variants of begin:

bool begin(void);
    bool begin(const IPv4& ip);
    bool begin(const IPv4& ip, const IPv4& ipGateway);
    bool begin(const IPv4& ip, const IPv4& ipGateway, const IPv4& subnetMask);

So you can use:

IPv4 MyIP = {192, 168, 20, 2};

Then later:


It defaults to a /24 subnet.

The TCPEchoServer.ino example uses that method.


Sun, 03 Jan 2021 18:32:22 +0000

Thank you so much sir, I used TCPEchoserver example to assign chipkit as server with a static IP. I also wanted to know if the connection is cut in between is there any ways to automatically reinitialize the TCP connection Thank you sir , @majenko