Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
N

NewHSKid

@NewHSKid
About
Posts
43
Topics
19
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Receive vs ReceiveFrom...
    N NewHSKid

    Who said that was put there for pity? That is really in there so that people DON'T talk down to me and like I am an idiot. I don't believe your comment was necessary, considering that it has nothing to do with pity. Thank you for your help though. I appreciate it. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC question visual-studio help

  • Receive vs ReceiveFrom...
    N NewHSKid

    Hi everyone, I posted this question earlier today but i didn't get a response. I am a mini jam here, so I decided to ask it again. To the people who read my first post, SORRY! I need to look into a UDP buffer but just peek at it. I have read that I can use MSG_PEEK with ReceiveFrom, but can I use it was Receive? I use Receive(,,MSGPEEK) with a TCP implementation and it works perfectly. How would I do this in UDP? Here is what I have;

    unsigned int temp;
    
    int rVal = Receive(&temp, sizeof(temp), MSG_PEEK);
    if(rVal < 0)
    {
       int err = GetLastError();
    }
    
    else
    {
       unsigned int RecvBuf;
       int rVal2 = Receive(&RecvBuf, sizeof(RecvBuf));   //No peek!
       ...
    }
    

    Any help would be appreciated greatly. If you have code that does this, i would also appreciate that too. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC question visual-studio help

  • UDP Client
    N NewHSKid

    Hi everyone, I have a UDP client running. I wanted to know if I can use the flag MSG_PEEK when doing a Receive. I keep getting an error (WSAEMSGSIZE (10040)) which says the message is too long. What is currently in the buffer is a 12 bytes message. I want to just peek at the first 4 bytes so that I know how to process it. I have a temp buffer declared as 4 bytes to store and determine what kind of message it is, but it keeps reading all 12 bytes, trancating, and returning an error. What I want it to do is peek at the buffer and then process each type of message. In the process method of each type, that is where I would like to take the info out the buffer. I do this same method for TCP client and it works fine. What should I be doing to have this perform like I want and how I have it in my TCP client app? Thanks in advance. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC question help tutorial

  • TCP help
    N NewHSKid

    Hi all, I have an app done in MFC, but I am having some problems with the ethernet part. My app is the client end that connects perfectly fine with a server up and running. The problem I am running into is when the server is not up but I type in the IP of it. It continues to say that it is connect. The only error that I ignore is error #10035 WSAEWOULDBLOCK. (i was told that this was an "OK" error) Basically as long as the IP or host name I enter is valid it says it is connected even though there is nothing there to connect to. How do I fix this problem so it recognize errors such as #10064 WSAEHOSTDOWN or #11001 WSAEHOST_NOT_FOUND Can someone also please tell me to how to check if at anytime that the connection is lost, reset by peer (or any other error that occurs that will not let me send data to the server) occurs how to immediately tell the user? Here is the code I am using:

    int connection = sock->Create(0, SOCK_STREAM, FD_READ | FD_WRITE, NULL );
    
    if (connection == FALSE)
    {
        int ret = sock->GetLastError();
        m_Listbox.AddString("Failed to create socket");
    }
    
    else
        m_Listbox.AddString("Socket Created");
    
    int rVal = sock->Connect(servername, port) ;
    
    if (rVal == FALSE)
    {
        int	ret = sock->GetLastError();
    				
        if(ret == WSAEWOULDBLOCK)
        {
    	// Left blank for blocking 
        }
        else
        {
            m_Listbox.AddString("Didn't connect");
            return;
        }
    }
    else
        m_Listbox.AddString("Connected");
    

    Many thanks in advance Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC help question c++ sysadmin tutorial

  • Listbox help
    N NewHSKid

    Hi all, I posted this a couple days ago but didn't get any response. Thought i would try to post it again and see if someone could help. Wanted to know if it is possible to both pad a hex numbers with leading 0's and also format the width of the message. I have a string and i just concat a hex number to it. I just want to space out the numbers so that they will line up with the next string added, so that it has the look of a table. Right now i am padding the hex number like this:

    int myString = 10005;
    int myString2 = 20003;
    testStr.Format("%03X" , myString);
    Str += testStr;
    testStr.Format("%03X" , myString2);
    Str += testStr;
    Listbox.AddString(Str);
    

    I know if i take away the 0, then it will set the width, but i need to do both. CAN THIS BE DONE? thanks in advance. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC help question

  • help with List box
    N NewHSKid

    Hi, would you be offended if i asked this to other members of the forum? (post a new message about this?) thanks again for your help Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC help tutorial question

  • Addstring in ListBox
    N NewHSKid

    oops...sorry about that yes, both myString and myString2 are numbers that needs to be displayed as hex Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC question

  • help with List box
    N NewHSKid

    Can a list control insert across columns? Something along the line of merging cells in MS excel? Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC help tutorial question

  • Addstring in ListBox
    N NewHSKid

    Hi all, Wanted to know if it is possible to both pad a hex numbers with leading 0's and also format the width of the message. I have a string and i just concat a hex number to it. I just want to space out the numbers so that they will line up with the next string added, so that it has the look of a table. Right now i am padding the hex number like this:

    testStr.Format("%03X" , myString);
    Str += testStr;
    testStr.Format("%03X" , myString2);
    Str += testStr;
    Listbox.AddString(Str);
    

    I know if i take away the 0, then it will set the width, but i need to do both. CAN THIS BE DONE? thanks in advance. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC question

  • help with List box
    N NewHSKid

    Hi, I wanted to clarify what i needed. I want to be able to add the other types of equpiment as the way i entered in the example as well as write a sentence that will go across the columns. I want to be able to write a description or a cause for the purchases that are made that are not baseball related. So in other words, I want to put to be able to put the paragraph above under the basketball equpiment purchases and before having the last baseball item in the list in the columns again. Can this be done? I couldn't figure this out, so i went with the listbox. This is making it hard to get the baseball equpiment to be lined up though. Any help would be appreciated. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC help tutorial question

  • help with List box
    N NewHSKid

    Hi all, I need some help figuring out what to use for my app. I need to have a list of items displayed in a dialog window. I am stuck here because I am not sure I am doing the right thing. The list of item has to be displayed one after another, but one particular type of item has to be in columns. Lets say i want to list sporting equipment and only display the quantity and price for baseball equpi. So an example would be:

       `    Quantity        Price ($)      Total Price  **Baseball hat  4             $25               $100 Baseball ball 11            $5                $55**  Basketball shoes $100 Basketball shorts  $35 Basketball  $40 Soccer ball  $30  **Baseball bat  2             $65               $130**`
    

    Right now I am using a listbox because i don't think a list control will let me span across columns. Can this be done? Is there a way to format the string I add in the list box (using addstring()) to consistantly be in column alignment? THANKS for the help everyone Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC help tutorial question

  • Timers in MFC
    N NewHSKid

    There is a sleep function that you can use. I just use it as a puase between command, so if i think you want to use it for the same purpose it would be ok. Maybe you can display the first pic, then sleep, then remove the first pic and display the second pic? Sleep(time) btw, time is in milliseconds. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC csharp c++ tutorial question

  • Checking to see if filename entered
    N NewHSKid

    Hi all, I am having trouble coding this and wanted to know how to check if a user enters a filename to open. Basically I want to check to make sure the file name is not all spaces and that it is not blank. I am not using CFileDialog right now, just have a editbox and a browse button that i got from a CP article. Does anyone have code out there that does this? Can someone lead me in the right direction? Thanks for all your help . Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC help tutorial question

  • arrays
    N NewHSKid

    Hi all, got another simple/silly question. I am trying to make an array but i need to it to be of different lengths. For one case i need it to be 2 and another to be 8. i was trying to do this: int size = 0; if(myBool == TRUE) size = 2; else size = 8; int myArray [size]; .... Can someone tell me how to do this? I thought it was possible? Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC question data-structures tutorial

  • Couple question about Dialog in MFC
    N NewHSKid

    Hi all, Got a couple of easy question for the experts. :) My first question is how do i remove the "x" box to close a modal dialog? My second question is i want to know when using CFileDialog, is there a way to have the default file name to be incremented or have a number added to the end of it if it already exists? If someone could show me how to do this, i would really appreciate it. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC question c++ tutorial

  • Easy question about formatting a string
    N NewHSKid

    Hi everyone, Just a quick question. Is there a way to display binary when formatting a string? I know %d is decimal, %X is hex....is there one that even exists for binary? Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC question

  • Parse a binary number
    N NewHSKid

    Hi David, I know what the bitwise AND does, thats why i don't understand what you are saying. If I AND all 4 of the word chunks with 0x00000000f, then won't they all just evaluate to 0x00000000f because there is no 1's to match up to? Please correct me, I have a feeling I am not thinking about this correctly. Lets say I get the number as 0xA012B435. Using the bitwise AND will just make it 0. No? Thanks for your help. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC

  • Parse a binary number
    N NewHSKid

    I'm sorry, I posted my message incomplete. I updated the previous post. My question basically is if you are you the bitwise & operator with the first 8bits of the number, won't it end up being 0? So i guess my real question is what does the & 0x00000000f do after the number has been shifted 8 (16, 32)? thank you Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC

  • Parse a binary number
    N NewHSKid

    Hi David, Can you explain this to me a little more. I think I understand , but I am not exactly sure what the dwSome32BitNumber >> 8 (16,32) or dwSome32BitNumber >>= 8 does exactly with respect to the &0x00000000f. thanks again for your help Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC

  • Parse a binary number
    N NewHSKid

    Hi all, I was wondering if there was a way to parse a binary number that I receive over a TCP port, into either 4 bit chunks or into hex. Thank you. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)

    C / C++ / MFC
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups