#16
  1. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally posted by Loser
    Thanks a lot.
    Just one more question: I read TCP/IP protocol was made to "cancel" errors. Is my program OK (I tested it on localhost and it worked perfect) or do I still have to write programs which tests those bits...

    How can I do that?
    I don't understand what bits you are refering to.

    The udp protocol is "send and forget". It doesn't check with the destination whether the packet got there or not. If the packet does arrive but has parity errors, then -- I think, but haven't tested it -- the destination's recvfrom() function should return a -1 and WSAGetLastError should indicate the parity error. Or not; like I said, I haven't tested that yet.

    The tcp protocol is more robust and I assume that you are refering to it. It takes a large block of data and carves it up into multiple packets. Throughout the session, it performs hand-shaking with the destination, such that every packet the destination receives must be acknowledged (ACK/NACK) as received intact or with parity errors. If there are parity errors or no ACK/NACK is received for a particular packet, then the sender's tcp will resend it automatically. I don't know how much the connection has to degrade before recv() will return with an error, but normally all this parity checking and ACK/NACK'ing and resending goes on in the Transport Layer and is transparent to your application.

    Does that answer your question?
  2. #17
  3. It Doesn't Work!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Slovenia
    Posts
    112
    Rep Power
    11
    If I understand, you don't have to test parity when going through TCP/IP. Is that it?
  4. #18
  5. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally posted by Loser
    If I understand, you don't have to test parity when going through TCP/IP. Is that it?
    TCP/IP is a suite of protocols, which means that it includes lots and lots of different protocols. Which one are we talking about here?

    Specifically, the Transport Layer uses two protocols: tcp and udp. When you create a socket, you are required to declare whether it is going to be a tcp socket or a udp socket (or a raw socket, but that's an advanced topic that we won't get into now).

    The tcp protocol handles parity checking and retransmission requests automatically and outside of the purview of the application, so you have no way that I know of to learn whether a particular packet had passed its parity check or not. Again, I don't know whether failed parity on a udp packet would cause it to return an error condition or to simply ignore that a packet had tried to arrive at all. I also searched the list of Winsock error codes and found no reference to "parity".

    Now, if you want to, you can add a parity check to your data block, in which case the application would then check it and it can then explicitly request a retransmission. However, you would then be duplicating the efforts of the tcp protocol.
    Last edited by dwise1_aol; August 18th, 2003 at 09:53 AM.
  6. #19
  7. It Doesn't Work!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Slovenia
    Posts
    112
    Rep Power
    11
    Thanks a lot for replies. A LOT. :)
  8. #20
  9. It Doesn't Work!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Slovenia
    Posts
    112
    Rep Power
    11
    Originally posted by dwise1_aol
    Code:
    *((unsigned long*)(&sendString[0])) = htonl(GetTime(sTime));
        sendStringLen = 4;
    What means GetTime(sTime)? What's the difference between network-byte order and host-byte order? And what these two lines do?
  10. #21
  11. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally posted by Loser
    What means GetTime(sTime)?
    GetTime() is a function I wrote that gets the system time and converts it to timserver (port 37) time in accordance with RFC-868:
    The Time

    The time is the number of seconds since 00:00 (midnight) 1 January 1900 GMT, such that the time 1 is 12:00:01 am on 1 January 1900 GMT; this base will serve until the year 2036.

    For example:

    the time 2,208,988,800 corresponds to 00:00 1 Jan 1970 GMT,

    2,398,291,200 corresponds to 00:00 1 Jan 1976 GMT,

    2,524,521,600 corresponds to 00:00 1 Jan 1980 GMT,

    2,629,584,000 corresponds to 00:00 1 May 1983 GMT,

    and -1,297,728,000 corresponds to 00:00 17 Nov 1858 GMT.
    UNIX system time follows the same definition, except that it starts 70 years later in 1970. Therefore, GetTime gets the UNIX system time and adds the timserver time offset of 2,208,988,800 (i.e., what the timserver time was when UNIX time started at 00:00 01 Jan 1970 GMT).

    The char* parameter, sTime, is just for my own convenience, since I have the server print to the screen what client it serviced and at what time. sTime just keeps me from having to call time() more than once. Of course, that report was only for test purposes, but if one were to want to keep a log of clients serviced by this server, then sTime would still be useful.

    I've listed below the GetTime() function, how it is called, and how sTime gets used.

    Code:
    #define TIME_OFFSET_1970  2208988800UL
    
    unsigned long GetTime(char *sTime)
    {
            time_t  Time;
            struct tm* t;
    
            time(&Time);
            t = localtime(&Time);
            strcpy(sTime,asctime(t));
            return (unsigned long)Time + TIME_OFFSET_1970;
    }
    
    ...
    
    
                    if ((respStringLen = recvfrom(sock, (char *)buffer, BUFFERMAX, 0,
                                            (struct sockaddr *) &fromAddr, (int *)&fromSize)) < 0)
                            DieWithError("recvfrom() failed");
    
                    *((unsigned long*)(&sendString[0])) = htonl(GetTime(sTime));
                    sendStringLen = 4;
    
             if (sendto(sock, sendString, sendStringLen, 0,
                              (struct sockaddr *)&fromAddr, fromSize) != sendStringLen)
                 DieWithError("sendto() sent a different number of bytes than expected");
    
            printf("Serviced request from %s at %s\n",inet_ntoa(fromAddr.sin_addr),sTime);
    Originally posted by Loser
    What's the difference between network-byte order and host-byte order? And what these two lines do?
    This is a time server, so what those two lines are doing is that they are loading the data packet with the time, which is four bytes long (hence the length) and which the call to sendto() then sends to the client that had requested it.

    Now, the difference between network byte-order and host byte-order is extremely important; I cover it in my sockets programming pages (still under construction) at http://members.aol.com/DSC30574/sock...tml#BYTE_ORDER .

    Basically, the order of the bytes in multi-byte numeric values can either go from high-order to low-order or from low-order to high-order. The hex value of 0x12345678 could either be stored as [12 34 56 78] or as [78 56 34 12]. Some hosts do it one way and others the other way; for example, Intel uses the reversed order, [78 56 34 12]. Network byte-order will always represent that value as [12 34 56 78].

    The data payload, the time, needs to be in network byte-order, which is why I used the htonl() function to convert it. If I hadn't done that in the server AND ALSO not done it in the client, then I could get away with it as long as the two hosts involved used the same byte-order. But if any standard client (ie, one that is doing it correctly) were to try to use my incorrect server (which is on an Intel platform), it would misinterpret the data as a nonsensical time. The same would apply if I were to use my incorrect client (which is on an Intel platform) to get the time from a standard server (eg, udp port 37 on zeus.tamu.edu or time.zyfer.com). Therefore, both my server and client had to apply htonl and ntohl respectively to the data packet and I verified that the standard servers do the same.

    I've attached the source code for the time server, udptimed, and time client, udptimec. I had done udptimec as a VC++6 project and udptimed under gcc. I've also included executables, but you should treat them with the appropriate degree of suspicion.
    Attached Files
    Last edited by dwise1_aol; August 21st, 2003 at 01:49 PM.
  12. #22
  13. It Doesn't Work!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Slovenia
    Posts
    112
    Rep Power
    11
    Jesus, that's complicated for a beginner...
    Thanks for your effort. I'll try to re-write this code to send my IP to me. ;)
  14. #23
  15. It Doesn't Work!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Slovenia
    Posts
    112
    Rep Power
    11
    I wrote this:


    Code:
    //sending program
    int gp;
    	char buffer[BS];
    	ZeroMemory(buffer, BS);
    	strcpy(buffer, "test");
    	WSADATA wsadata;
    	WORD version = MAKEWORD(1,1);
    
    	WSAStartup(version, &wsadata);
    
    	SOCKET ssocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
    
    	SOCKADDR_IN addr;
    	addr.sin_family = AF_INET;
    	addr.sin_port = htons(80);
    	addr.sin_addr.s_addr = inet_addr("127.0.0.1");
    
    	gp = sendto(ssocket,buffer, strlen(buffer), 0,(struct sockaddr *)&addr, sizeof(addr));
    
    	closesocket(ssocket);
    	WSACleanup();
    and this:
    Code:
    //receiving program
    WSADATA wsadata;
    	WORD version = MAKEWORD(1,1);
    	char buffer[BS];
    	int gp;
    
    	WSAStartup(version, &wsadata);
    
    	SOCKET rsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
    
    	SOCKADDR_IN addr, remote_addr;
    	addr.sin_family = AF_INET;
    	addr.sin_port = htons(80);
    	addr.sin_addr.s_addr = INADDR_ANY;
    	bind(rsocket, (struct sockaddr *) &addr, sizeof(addr));
    
    	int iRemoteAddrLen = sizeof(remote_addr);
    
    	gp = recvfrom(rsocket, buffer, BS, 0, (struct sockaddr *)&addr, &iRemoteAddrLen);
    
    	printf("received from %s\n",inet_ntoa(remote_addr.sin_addr));
    	closesocket(rsocket);
    	WSACleanup();
    It works, but it doesn't return the right IP. My ip is 193.95.231.95 (it's not static), but I got 90.90.250.255. Why?
  16. #24
  17. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally posted by Loser
    I wrote this:


    Code:
    //sending program
    int gp;
    	char buffer[BS];
    	ZeroMemory(buffer, BS);
    	strcpy(buffer, "test");
    	WSADATA wsadata;
    	WORD version = MAKEWORD(1,1);
    
    	WSAStartup(version, &wsadata);
    
    	SOCKET ssocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
    
    	SOCKADDR_IN addr;
    	addr.sin_family = AF_INET;
    	addr.sin_port = htons(80);
    	addr.sin_addr.s_addr = inet_addr("127.0.0.1");
    
    	gp = sendto(ssocket,buffer, strlen(buffer), 0,(struct sockaddr *)&addr, sizeof(addr));
    
    	closesocket(ssocket);
    	WSACleanup();
    and this:
    Code:
    //receiving program
    WSADATA wsadata;
    	WORD version = MAKEWORD(1,1);
    	char buffer[BS];
    	int gp;
    
    	WSAStartup(version, &wsadata);
    
    	SOCKET rsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
    
    	SOCKADDR_IN addr, remote_addr;
    	addr.sin_family = AF_INET;
    	addr.sin_port = htons(80);
    	addr.sin_addr.s_addr = INADDR_ANY;
    	bind(rsocket, (struct sockaddr *) &addr, sizeof(addr));
    
    	int iRemoteAddrLen = sizeof(remote_addr);
    
    	gp = recvfrom(rsocket, buffer, BS, 0, (struct sockaddr *)&addr, &iRemoteAddrLen);
    
    	printf("received from %s\n",inet_ntoa(remote_addr.sin_addr));
    	closesocket(rsocket);
    	WSACleanup();
    It works, but it doesn't return the right IP. My ip is 193.95.231.95 (it's not static), but I got 90.90.250.255. Why?
    You fell victim to a typographical error. Your printf uses the address structure remote_addr, but your recvfrom call uses addr to receive the remote address. Try it with remote_addr instead:
    Code:
    	gp = recvfrom(rsocket, buffer, BS, 0, (struct sockaddr *)&remote_addr, &iRemoteAddrLen);
  18. #25
  19. It Doesn't Work!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Slovenia
    Posts
    112
    Rep Power
    11
    My avatar tells everything. :)

    Now it works, but it returns 127.0.0.1. That's unuseful.
  20. #26
  21. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally posted by Loser
    My avatar tells everything. :)

    Now it works, but it returns 127.0.0.1. That's unuseful.
    You were running both the sender and receiver on the same host and the sender used the localhost address of 127.0.0.1. Try giving the sender your IP address instead.

    For example, running my timserver server and client both on the same host, these are what were reported on the displays (actual IP address munged for security reasons):
    Code:
    Client:
    
    C:\>udptimec localhost 37
    Sending 0-byte query to localhost:time [127.0.0.1:37]
    Received 4 bytes from localhost [127.0.0.1:37]
    C2 F0 E6 27                                        ...'
     **********
    Universal Coordinated Time is Fri Aug 22 18:57:43 2003
    
    
    
    C:\>udptimec pc14402 37
    Sending 0-byte query to pc14402:time [192.168.69.151:37]
    Received 4 bytes from pc14402 [192.168.69.151:37]
    C2 F0 E6 3C                                        ...<
     **********
    Universal Coordinated Time is Fri Aug 22 18:58:04 2003
    
    
    
    C:\>
    
    Server:
    
    C:\dcw\PROJECTS\WS\UDPtimed>udptimed 37
    Starting timserver on port 37
    Serviced request from 127.0.0.1 at Fri Aug 22 11:57:43 2003
    
    Serviced request from 192.168.69.151 at Fri Aug 22 11:58:04 2003
    As you can see, when I addressed localhost, the remote address received was 127.0.0.1. But when I addressed myself via my IP address as if I were addressing myself from another host, I did get my IP address as the remote address.

    Give that a try.

    It's kind of like pinging yourself. If you ping localhost, then it only checks the TCP/IP stack bypassing the network interface card (NIC). But if you ping your own IP address, then it goes through the NIC and even out onto the network, I think.

    [NOTE: Never mind about that last point. I ran tcpdump on my Linux box and on my Win98SE box pinged the Linux box, then localhost, then the Win98SE box. Only the ping to the Linux box showed up. Therefore, it would appear that pinging to your own IP address does not get out onto the network, but it still does exercise a lot more of the protocol stack and network hardware than pinging localhost does. ]
    Last edited by dwise1_aol; August 22nd, 2003 at 02:17 PM.
  22. #27
  23. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally posted by Loser
    I wrote this:


    Code:
    ...
    
    	SOCKADDR_IN addr, remote_addr;
    	addr.sin_family = AF_INET;
    	addr.sin_port = htons(80);
    	addr.sin_addr.s_addr = INADDR_ANY;
    	bind(rsocket, (struct sockaddr *) &addr, sizeof(addr));
    
    ...
    ...

    Just in case it comes up, normally the htonl() is used when setting s_addr to INADDR_ANY; e.g.:
    Code:
    	addr.sin_addr.s_addr = htonl(INADDR_ANY);
    However, in mid-message, I decided to see exactly what value INADDR_ANY is set to. The results of my grep on the Visual C++ include files:
    File WINSOCK.H:
    #define INADDR_ANY (u_long)0x00000000
    File WINSOCK2.H:
    #define INADDR_ANY (u_long)0x00000000
    #define ADDR_ANY INADDR_ANY
    Both on Red Hat Linux and in the MinGW port of gcc, the definition for INADDR_ANY is the same as in VC++: ((in_addr_t) 0x00000000) or (u_long)0 .

    Therefore, in reality, it doesn't make any difference whether we use htonl() or not, since a unsigned long of 0 is the same no matter how you order the bytes.

    I only mention it now in case somebody raises the question later, as I was about to.
  24. #28
  25. It Doesn't Work!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Slovenia
    Posts
    112
    Rep Power
    11
    I tried and it works, but that makes no sense - I still have to find my IP. Or other way: you typed your machine name - is there a function which tells you your name? I could use it and get my IP. Maybe it could go even without sending and receiving...
  26. #29
  27. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally posted by Loser
    I tried and it works, but that makes no sense - I still have to find my IP. Or other way: you typed your machine name - is there a function which tells you your name? I could use it and get my IP. Maybe it could go even without sending and receiving...
    Doing Domain Name Service (DNS) resolution in sockets is very easy, because it provides you with the functions:
    int gethostname(char* hostName, unsigned int length);
    struct hostent *gethostbyname(const char *hostName);
    struct hostent *gethostbyaddr(const char *address, int addressLength, int addressFamily); // family == AF_INET
    struct servent *getservbyname(const char* serviceName, const char *protocol);
    e.g. getservbyname("telnet","tcp");
    struct servent *getservbyport(int port, const char *protocol);

    So you call gethostname() to get your computer's name, then pass that to gethostbyname() to get its IP address.

    Look in the ZIP file I uploaded in this thread, udptimec.zip. In the utils.cpp file are two functions, ResolveHostAddress and ResolveService, which use those sockets functions to get the IP address of a given host and the port number of a given service. That's how I was able to just give the udptimec program a host name and the program then looked up the IP address for it.

    One of the very earliest sockets programs I wrote was ident, which used these functions to obtain name and IP data on a computer. I also wrote it to try to figure out the hostent struct, which I couldn't find much documentation on at the time. Against my better judgement, here's the listing (125 lines):
    Code:
    /* ident.cpp                                                   
     *                                                                         
     * Obtains host name and IP address automatically  
     */
    
    #include <stdlib.h>     /* for exit() */
    #include <stdio.h>      /* for printf(), fprintf() */
    #include <winsock.h>    /* for socket(),... */
    
    /*
    struct  hostent {
            char    FAR * h_name;           /* official name of host */
            char    FAR * FAR * h_aliases;  /* alias list */
            short   h_addrtype;             /* host address type */
            short   h_length;               /* length of address */
            char    FAR * FAR * h_addr_list; /* list of addresses */
    #define h_addr  h_addr_list[0]          /* address, for backward compat */
    };
    */
    
    
    /////////////////////////////////////////////////////////////////////////////
    // Local data
    const char *sAddrFamilies[] = {
    		"AF_UNSPEC",	/* unspecified */
    		"AF_UNIX",	/* local to host (pipes, portals) */
    		"AF_INET",	/* internetwork: UDP, TCP, etc. */
    		"AF_IMPLINK",	/* arpanet imp addresses */
    		"AF_PUP",	/* pup protocols: e.g. BSP */
    		"AF_CHAOS",	/* mit CHAOS protocols */
    		"AF_IPX",		/* IPX and SPX */
    		"AF_OSI",		/* ISO protocols */
    		"AF_ECMA",	/* european computer manufacturers */
    		"AF_DATAKIT",	/* datakit protocols */
    		"AF_CCITT",	/* CCITT protocols, X.25 etc */
    		"AF_SNA",	/* IBM SNA */
    		"AF_DECnet",	/* DECnet */
    		"AF_DLI",		/* Direct data link interface */
    		"AF_LAT",		/* LAT */
    		"AF_HYLINK",	/* NSC Hyperchannel */
    		"AF_APPLETALK",	/* AppleTalk */
    		"AF_NETBIOS",	/* NetBios-style addresses */
    		"AF_VOICEVIEW",	/* VoiceView */
    		"AF_FIREFOX",	/* FireFox */
    		"AF_UNKNOWN1",	/* Somebody is using this! */
    		"AF_UNKNOWN1", 	/* Somebody is using this! */
    		"AF_BAN",	/* Banyan */
    		"AF_MAX"
    	};
    
    
    void DieWithError(char *errorMessage);  /* Error handling function */
    
    void main(int argc, char *argv[])
    {
        WORD wVersionRequested;          /* Version of Winsock to load */
        WSADATA wsaData;                 /* Winsock implementation details */ 
        struct hostent *he;
        char name[41];
        int  i;
        struct in_addr addr;
    
        wVersionRequested = MAKEWORD(2, 0);   /* Request Winsock v2.0 */
        if (WSAStartup(wVersionRequested, &wsaData) != 0) /* Load Winsock DLL */
        {
            fprintf(stderr,"WSAStartup() failed");
            exit(1);
        }
    
        if (gethostname(name, 40))
        {
            fprintf(stderr,"gethostname failed");
            exit(1);
        }
    
        printf("Hostname = %s\n",name);
    
        he = gethostbyname(name);
    
        if (he == NULL)
        {
            DieWithError("gethostbyname failed");
        }
        else
        {
            printf("h_name = %s\n",he->h_name);
        }
    
        if (he->h_aliases[0] == NULL)
            printf("No aliases.\n");
        else
        {
            printf("Aliases:\n");
            for (i = 0; he->h_aliases[i] != 0; ++i) 
            {
                printf("  %d. %s\n",i+1,he->h_aliases[i]);
            }
        }
    	
        printf("h_addrtype = %s [%d]\n",sAddrFamilies[he->h_addrtype],he->h_addrtype);
        printf("h_length = %d\n",he->h_length);
    
        if (he->h_addr_list == NULL)
            printf("No h_addr_list present.\n");
        else
        {
            printf("h_addr_list:\n");
            for (i = 0; he->h_addr_list[i] != 0; ++i) 
            {
                memcpy(&addr, he->h_addr_list[i], sizeof(struct in_addr));
                printf("  Addr #%d: %s\n",i,inet_ntoa(addr));
            }
        }
    
        WSACleanup();  /* Cleanup Winsock */
        exit(0);
    }
    
    
    void DieWithError(char *errorMessage)
    {
        fprintf(stderr,"%s: %d\n", errorMessage, WSAGetLastError());
        exit(1);
    }
    Last edited by dwise1_aol; August 22nd, 2003 at 05:13 PM.
  28. #30
  29. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Location
    ct
    Posts
    2,756
    Rep Power
    95
    dwise<< when you send urself a packet via ur own ip address it makes it down to the link level where an ethernet header is slapped on, then it is passed back to the BPF and the protocol stack. to the best of my knowledge, this happens for both loopback and 'your ip address' packets. i think tcpdump just chooses to ignore loopback. here is a dump from a packet sniffer i wrote:
    `'~;-. <sniff> .-;~'`

    (10615949) 1{ (127.0.0.1.6969 --> 127.0.0.1.80) [seq=2917858286] [ack=0] [win=57082] [flags= ] [IPv=4] [tlen=40] [ttl=255]
    (00.57 ) 2{ (127.0.0.1.80 --> 127.0.0.1.6969) [seq=0] [ack=2917858286] [win=0] [flags= A:R:] [IPv=4] [tlen=40] [ttl=64]
    (01.42944) 3{ (127.0.0.1.6969 --> 127.0.0.1.80) [seq=2934635502] [ack=0] [win=57082] [flags= ] [IPv=4] [tlen=40] [ttl=255]
    (00.50 ) 4{ (127.0.0.1.80 --> 127.0.0.1.6969) [seq=0] [ack=2934635502] [win=0] [flags= A:R:] [IPv=4] [tlen=40] [ttl=64]
    (00.50183) 5{ (127.0.0.1.6969 --> 127.0.0.1.80) [seq=2951412718] [ack=0] [win=57082] [flags= ] [IPv=4] [tlen=40] [ttl=255]
    (00.49 ) 6{ (127.0.0.1.80 --> 127.0.0.1.6969) [seq=0] [ack=2951412718] [win=0] [flags= A:R:] [IPv=4] [tlen=40] [ttl=64]
    (15.42945) 7{ (77.77.77.178.6969 --> 77.77.77.178.80) [seq=2917858286] [ack=0] [win=57082] [flags= ] [IPv=4] [tlen=40] [ttl=255]
    (00.57 ) 8{ (77.77.77.178.80 --> 77.77.77.178.6969) [seq=0] [ack=2917858286] [win=0] [flags= A:R:] [IPv=4] [tlen=40] [ttl=64]
    (00.50119) 9{ (77.77.77.178.6969 --> 77.77.77.178.80) [seq=2934635502] [ack=0] [win=57082] [flags= ] [IPv=4] [tlen=40] [ttl=255]
    (00.51 ) 10{ (77.77.77.178.80 --> 77.77.77.178.6969) [seq=0] [ack=2934635502] [win=0] [flags= A:R:] [IPv=4] [tlen=40] [ttl=64]
    (01.42944) 11{ (77.77.77.178.6969 --> 77.77.77.178.80) [seq=2951412718] [ack=0] [win=57082] [flags= ] [IPv=4] [tlen=40] [ttl=255]
    (00.51 ) 12{ (77.77.77.178.80 --> 77.77.77.178.6969) [seq=0] [ack=2951412718] [win=0] [flags= A:R:] [IPv=4] [tlen=40] [ttl=64]
    edit: dwise<< i was thinking about a way to obtain your NAT'ed ip address solely using 1 program and 1 computer(i.e. no script from a server). and this is what i came up with:
    a)is there a way to query a router for its interfaces? on one side will be our local subnet and then the other our internet IP.
    b)what about sending a traceroute like packet with a ttl of 2? when it comes back it should have the outgoing interface of the router in it, yes?

    can you think of any other way? im going to try and implement b.
    Last edited by infamous41md; August 22nd, 2003 at 09:49 PM.

IMN logo majestic logo threadwatch logo seochat tools logo