You are still not addressing the problem correctly. You are trying to add an element into the array, so you need to increase its size first to accommodate the new entry. Your code is just overwriting two entries with different values. Try drawing the array on paper and see what you need to do to add a new value in the middle.
I did increase the size of array by calling the array and increase the size using this variable
Incrementing a variable does not change the size of the array. You need to create a new array and copy the values into it allowing an empty cell where the new value is to be added. Then you can add that new value into the empty cell.
well your use of 'unavailable' hit the nail on the head for the case I was thinking of - 'client had disconnected, but port was in timeout-wait' - ergo, not technically in use .. this may be particular to the scenario/implementation I see if happen in (a lot, unfortunately)
as to more than one connection to a port, I'd have to go back to my W Richard Stevens to check - I know what we 'see' happening in a lot of cases - eg multiple connectiins to tcp://w.x.y.z:80 may not necessarily be the case - the initial connection is accepted on that port, but then 'spun off' to be handled as a seperate conversation, leaving port 80 free
I like to learning C++ with some GUI framework. After searching on Internet MFC is good native development tool for Developers but I have problem is there any value learning MFC nowadays? Because in Windows 8 application type that called Metro applications or give me some good framework to learn C++ GUI Programming
With MFC, problems that should take minutes to solve sometimes take days.
How so? I always found it very simple, and if you want part of th win32 api that isnt wrapped by MFC you just call it directly. You can edit the message map simply to add WM_XXXXX commands that arent handled by the class wizzard, and can simply modify the comnstructors to pass all kinds of data round.
The only complexity would be implementing something complex, like windows hooks or some such, but that would be the same with MFR of raw win32 API.
But I agree, learn .Net and C#, it has WAY more commercial demand. (By the way, I didnt know you can use C++ with ,Net. I am a kernel guy and dont venture into user mode that much these days.)
The consistently incomplete documentation for MFC makes it difficult to use.
Of course an MFC expert can easily use it to solve problems. But it's not user friendly to someone who's not an expert. With .NET and intellisense, you can use .NET effectively even if you don't know it very well.
A couple examples of MFC landmines that eat up the hours and days of your development time:
1. You have a CBitmap and you want to load a .bmp file from disk. How do you do it?
(HINT: CBitmap::LoadBitmap () doesn't work. How retarded is that?)
2. You see that OnDraw () is used to update windows. Fair enough. But you try to use it on a CDialog and it doesn't f***ing work!. Part B: You try to use it on a CFrameWnd and it doesn't f***ing work, but for a DIFFERENT reason!
MFC is full of garbage like this! (And I used it back in 1997 when you couldn't just go to the Internet for a quick answer.) MFC is one of the reasons I hate Microsoft!
I think it was a combination of incompetence, lack of vision, arrogance and a fear of lawsuits (for the JPG and zip stuff.)
Alan Balkany wrote:
undocumented functionality to slow them down.
Contrary to popular belief, that is very rare. Almost all undocumented functionality that is useful is actually provided through other means. Frankly, the biggest problems with Windows is the COM kick they got on in the 90s and that Microsoft engineers tend to over-engineer everything favoring complexity over simplicity (an all too common problem with all engineers.)
There is a value in MFC even this days. A lots of applications are written with MFC, and some of them(which are usually time critical or compute intence) are still will be written in MFC.
If you interested in learning MFC, the good start is Ivor Horton's "Visual C++ 2010".