monapi
Posts: 45
Joined: Tue Aug 07, 2018 7:53 am

raspberry pi can not connect to an IP unless ping it first

Wed Nov 14, 2018 10:59 am

i write a server script in python and run this script on raspberry pi. to test this script i run a TCP client on another computer. while server is listening and waiting for a client to connect to it, the client cant connect to the server and shows TCP connection timeout error. if i ping client IP in raspberry pi, after that client can connect to the server.
i want to know what the problem is and how can i fix it?
thank you

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: raspberry pi can not connect to an IP unless ping it first

Wed Nov 14, 2018 11:19 am

I think you need to research the role of the Address Resolution Protocol (ARP) in running an Internet Protocol (IP) network.

monapi
Posts: 45
Joined: Tue Aug 07, 2018 7:53 am

Re: raspberry pi can not connect to an IP unless ping it first

Thu Nov 15, 2018 7:23 am

i check the packet that is sended from PC to the raspberry pi with "tcmpdump" and it doesn't show any packet. the client sends packet to connect with raspberry but it cant connect to it so "tcpdump" doesnt show any packet. i try to send packet between my mobile phone and PC and it works fine but to connect to raspberry it should ping them first. i thought it may relate to the raspberry pi firewall i check it with this command:
sudo iptables -L
and all the three parts were set to "ACCEPT".
a few days before this problem, i try to make raspberry pi to a access point and use this tutorial https://www.raspberrypi.org/documentati ... s-point.md and i disable it(configuring access point) with commenting the static IP.
i want to know could it be the reason that blocking the packets?

Return to “Beginners”