Mavlink connection with raspberry pi

Hi all,
I am trying to connect the raspberry with mavlink to upload the waypoints but when opening and downloading SITL on Mission planner it is automatically getting connected. but when i am connected it manually it is asking the hostname and remote IP , on entering it its shows connection failed . but when it is automatically connected after downloading the SITL it and later on when sending a command from the raspberry pi
the error shown is the “connection timed out”