Click here to Skip to main content
15,921,841 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWhy wouldn't MFC exe ole server unload? Pin
CherezZaboro6-Jun-03 6:31
CherezZaboro6-Jun-03 6:31 
AnswerRe: Why wouldn't MFC exe ole server unload? Pin
Ryan Binns7-Jun-03 21:11
Ryan Binns7-Jun-03 21:11 
GeneralChanging text color in static text control Pin
AJarrett6-Jun-03 5:33
AJarrett6-Jun-03 5:33 
GeneralRe: Changing text color in static text control Pin
valikac6-Jun-03 6:10
valikac6-Jun-03 6:10 
GeneralRe: Changing text color in static text control Pin
AJarrett6-Jun-03 7:24
AJarrett6-Jun-03 7:24 
GeneralRe: Changing text color in static text control Pin
John R. Shaw6-Jun-03 9:31
John R. Shaw6-Jun-03 9:31 
GeneralRe: Changing text color in static text control Pin
AJarrett6-Jun-03 10:49
AJarrett6-Jun-03 10:49 
Generalincreasing sequence number on raw socket Pin
Kuniva6-Jun-03 5:16
Kuniva6-Jun-03 5:16 
I have a raw socket and i construct its IP and TCP header myself. The TCP header is like the following:
#pragma pack(1)
struct tcpheader {
	unsigned short int th_sport;
	unsigned short int th_dport;
	unsigned int th_seq;
	unsigned int th_ack;
	unsigned char th_x2:4, th_off:4;
	unsigned char th_flags;
	unsigned short int th_win;
	unsigned short int th_sum;
	unsigned short int th_urp;
}; /* total tcp header length: 20 bytes (=160 bits) */

Now when i want to send a packet i fill in all the values and everything works great. I use a packet capturer to check if the values i filled in were actually the values transmitted. Now the problem is that i send packets in a while loop and everytime i increase the sequence number by one like this:

while (!kbhit())
{
    // Send The Packet
    if (sendto(s, datagram, 40, 0, (SOCKADDR *)&sin, sizeof(sin)) == SOCKET_ERROR)
    {
        printf("sendto() failed: %d\n", WSAGetLastError());
        return -1;
    }
    printf(".");
    Sleep(1000);
    tcph->th_seq++;
}


When i check the packets in my capture program i see that the first packet is in order if i set tcph->th_seq to 0. But if i use another value like 7000000 i see much larger number in my capture program, and also if the code increments from 0, the sequence number doesn't rise by 1 every packet but with A LOT more (the second packets sequence number is 16777216!). Could anyone explain why its not just incrementing by 1 each time, and how can i set the sequence number to the value i want?

Many thanks in advance

Kuniva
--------------------------------------------
GeneralRe: increasing sequence number on raw socket Pin
Mike Nordell6-Jun-03 8:42
Mike Nordell6-Jun-03 8:42 
GeneralRe: increasing sequence number on raw socket Pin
Kuniva6-Jun-03 11:19
Kuniva6-Jun-03 11:19 
GeneralZlib for Dos Pin
WAQAS AHMED6-Jun-03 4:15
WAQAS AHMED6-Jun-03 4:15 
Generalmicrosoft dialog with tabctrl wanted Pin
Tibor Blazko6-Jun-03 3:59
Tibor Blazko6-Jun-03 3:59 
Questionhow to use the srand function??? Pin
siong6-Jun-03 3:06
siong6-Jun-03 3:06 
AnswerRe: how to use the srand function??? Pin
David Chamberlain6-Jun-03 3:29
David Chamberlain6-Jun-03 3:29 
GeneralRe: how to use the srand function??? Pin
Anonymous6-Jun-03 4:00
Anonymous6-Jun-03 4:00 
GeneralConvert CString to char * Pin
Vassili6-Jun-03 3:01
Vassili6-Jun-03 3:01 
GeneralRe: Convert CString to char * Pin
Anonymous6-Jun-03 3:32
Anonymous6-Jun-03 3:32 
GeneralRe: Convert CString to char * Pin
Rage6-Jun-03 3:41
professionalRage6-Jun-03 3:41 
GeneralRe: Convert CString to char * Pin
jhwurmbach6-Jun-03 4:35
jhwurmbach6-Jun-03 4:35 
GeneralRe: Convert CString to char * Pin
Rage6-Jun-03 5:21
professionalRage6-Jun-03 5:21 
GeneralRe: Convert CString to char * Pin
jhwurmbach6-Jun-03 5:27
jhwurmbach6-Jun-03 5:27 
GeneralRe: Convert CString to char * Pin
Michael Dunn6-Jun-03 9:08
sitebuilderMichael Dunn6-Jun-03 9:08 
QuestionWhere to find common toolbar xp icons? Pin
Nicolas Bonamy6-Jun-03 2:37
Nicolas Bonamy6-Jun-03 2:37 
Question?????CListCtrl???? Pin
Stefcos6-Jun-03 1:59
Stefcos6-Jun-03 1:59 
AnswerRe: ?????CListCtrl???? Pin
David Crow6-Jun-03 2:27
David Crow6-Jun-03 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.