First of all I'd like to apologise for my bad English :) Yesterday I finished writing my first multiplayer game (Pong) in C++ using Winsock and Allegro5. The game consists of one server for all players and clients.
Every frame (FPS = 60) clients send their mouse_y coordinates to the server which passes them to their opponents' clients respectively. When I play the game on my 2 computers connecting to the server, which runs on one of them, by local network it works perfectly, opponent's paddle is moving smoothly. But when I do the same connecting through my external IP address the opponent's paddle is lagging, which ruins the game, because it's client which checks if the ball hit opponent's paddle or not. Thus synchronisation is ruined, whenever I move one paddle to bounce the ball on the other computer it lags and doesn't make it in time resulting in scoring a point for opponent... But it's not the game which is lagging. My paddle and the ball are moving smoothly. The problem is only with opponent's paddle.
I'm new to network programming as I've only read Beej's Guide to Network Programming. I use TCP sockets to send() and recv() coordinates of paddles and select() function to poll sockets for data.
I don't have a single idea what could be the cause.
TL;DR: Opponent's paddle lags when I connect through external IP, but it doesn't when I connect through local IP.