Re: Receiving packet for port 1025 unexpectedly causes RST of conn
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Tue, 19 Sep 2006 11:41:36 -0700
Well, I'm unable to duplicate any problem of this sort. I've written a
little program to open a socket, send some data through, periodically, for a
while, and put that EXE in the startup folder on my device. It connects
correctly on startup, sends its data, and, according to the sniffer, sends
no data to any port other than the one that I've specified.
Make sure that your device is not running any services that you don't want,
time server client, etc. Try the same test that I did, maybe. The code is
below my signature, but I couldn't use port 1030, as that's being used by
something running on my PC already. I get the feeling that this is actually
something that is being commanded by some piece of code on CE, rather than
bug in the OS. Maybe a logging program that sends failure logs to that
port, etc., etc. Maybe if you look at the actual data in the packet you'll
see something, but it appears to be an ack packet for an active
connection...
Paul T.
-----
// Port1025.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include <winsock.h>
void Log( char *str, int error )
{
// Open log file, deleting any existing file.
HANDLE hf = CreateFile( _T( "\\Port1025.log" ), GENERIC_READ |
GENERIC_WRITE, 0,
NULL, CREATE_ALWAYS, 0, NULL );
DWORD xcount;
WriteFile( hf, str, strlen( str ), &xcount, NULL );
// String-ize the error code and write that next.
char buf[ 128 ];
sprintf( buf, "%d", error );
WriteFile( hf, buf, strlen( buf ), &xcount, NULL );
CloseHandle( hf );
}
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
WSAData wsa;
WSAStartup( 0x0101, &wsa );
// Open a port connection to a port on a given host, send some messages
// to that port periodically for 60 seconds, then close the connection.
// If the connection is terminated from the other end, write a log file.
SOCKET s = socket( AF_INET, SOCK_STREAM, 0 );
if ( s == INVALID_SOCKET )
{
Log( "Error from socket() call", WSAGetLastError() );
goto err;
}
else
{
SOCKADDR_IN destaddr;
memset( &destaddr, 0, sizeof( destaddr ) );
destaddr.sin_family = AF_INET;
destaddr.sin_addr.s_addr = inet_addr( "172.16.12.1" );
destaddr.sin_port = htons( 4800 );
if ( connect( s, (sockaddr*)&destaddr, sizeof( destaddr ) ) ==
SOCKET_ERROR )
{
Log( "Error from connect() call", WSAGetLastError() );
goto err1;
}
DWORD starttime = GetTickCount();
do
{
char buf[ 1024 ];
sprintf( buf, "Message at tick count = %d\n", GetTickCount() );
// Send a message.
if ( send( s, buf, strlen(buf), 0 ) == SOCKET_ERROR )
{
Log( "Error from connect() call", WSAGetLastError() );
goto err1;
}
Sleep( 5000 );
} while ( GetTickCount() - starttime < 60000 );
}
err1:
closesocket( s );
err:
WSACleanup();
return 0;
}
-----
"photon209" <photon209@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D3AD983E-F76B-42BF-A5E8-81F2F53DDBF9@xxxxxxxxxxxxxxxx
Paul,
The packet for port 1025 is coming from the CE device, not the PC; then
the
PC sends the RST.
The results of my testing has shown that this event does not happen if I
wait ~20 seconds after the CE code comes up after a warm boot, and it is
intermittent before 20 seconds. Of course this doesn't happen at all
while
running the debugger, only a release build, so I can't get any debug
messages
from CE.
Observing messages in the debugger shows no activity a few seconds after
the
device is up and running. In other words, i don't see any activity 10, 15
seconds after the system is up.
-ed
"Paul G. Tobey [eMVP]" wrote:
There's nothing unusual about that packet and I see no connection between
that and the RST *by the PC*, I presume, of the other connection. Maybe
there's a bug in the PC code that causes it to send a packet to 1025 just
before dumping the connection to 1030, but I don't see any evidence that
CE
is the problem there. You could debug the PC program and make sure that
all
data sent by the CE device is being received and there isn't a window
size
problem or something of that sort, but I do this kind of thing all the
time
on CE and it's quite reliable as far as maintaining network connections
when
lots of stuff is going on on other ports.
Paul T.
"photon209" <photon209@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:73A9B4E1-16DF-46D4-9A23-3E63E593096D@xxxxxxxxxxxxxxxx
"Paul G. Tobey [eMVP]" wrote:
Draw us up a little diagram of what's going on.
okey dokey. deep breath....
We've added an Alchemy-based CE device to our product to add USB
functionality. We also use the CE device to forward packets received
on
TCP
port 1030 for our proprietary protocol. We also forward port 23 for
telnet.
So the CE device has two Ethernet ports - one connected to the outside
world, and one connected to our hardware. The CE is built as a
gateway.
When I see this TCP packet for port 1025, we are activly transferring
data
to our device - received by CE, forwarded to the internal port. A
response
is sent from our product, and forwarded by CE to the outside world, all
on
port 1030 using TCP. Most of the time this works just fine. We don't
use
port 1025 for anything, and during a good session, I never see anything
for
that port, so it appears the port 1025 message precipitates the RST
packet,
as the RST immediatly follows. Since CE is not configured to forward
anything from port 1025, and our product does not send anything on port
1025,
I am assuming that message originates from CE.
Here's a .bmp to a capture in Ethereal (which has a bug exporting,
grr):
http://img258.imageshack.us/img258/3875/port1025wr3.png
(The packet highlighted is the 1025 packet)
The PC is running NT, no firewall, on a crossover cable and an assigned
IP,
no DHCP. We have developed our own application running on the PC to
communicate over port 1030.
-ed
You didn't mention, for
example, whether the CE device is expecting something on that port,
whether
it's a TCP or a UDP port, etc. Is there a firewall running on the PC?
Who
is listening for this data, if anyone? What sort of a packet is it?
A
SYN
packet? Data? Ack?
Paul T.
"photon209" <photon209@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CE89B506-196F-4A1B-86C5-36C4DFFB2DAB@xxxxxxxxxxxxxxxx
Hi,
I've captured packets between my PC and my CE device (on a
crossover,
so
no
other traffic) and my connection drops (the PC generates a RST
packet)
when
the CE device sends a TCP packet for port 1025 (for the correct IP).
Most of the time everything works just dandy, except occasionally
this
1025
packet kills the connection. Can anyone tell me where this comes
from?
Is
this something I can control or turn off in CE?
-ed
.
- References:
- Re: Receiving packet for port 1025 unexpectedly causes RST of connecti
- From: Paul G. Tobey [eMVP]
- Re: Receiving packet for port 1025 unexpectedly causes RST of conn
- From: photon209
- Re: Receiving packet for port 1025 unexpectedly causes RST of conn
- From: Paul G. Tobey [eMVP]
- Re: Receiving packet for port 1025 unexpectedly causes RST of conn
- From: photon209
- Re: Receiving packet for port 1025 unexpectedly causes RST of connecti
- Prev by Date: Re: Receiving packet for port 1025 unexpectedly causes RST of conn
- Next by Date: Re: Application crashes when stop from running program list
- Previous by thread: Re: Receiving packet for port 1025 unexpectedly causes RST of conn
- Next by thread: Mouse not working after changing locale
- Index(es):
Relevant Pages
|