|
You need not to anything different at client side. The required capability needs to be implemented at server side. Your server should be able to server multiple request/connections.
In your case, when server accepts the first connection, it should spawn the thread to handle the requests from the connected client and the main thread should continue listening of the socket for any new connection.
Sample 1.[^]
Sample 2.[^]
|
|
|
|
|
Server Side:
m_pSocket->Create(1500);
m_pSocket->Listen();
m_pSocket->Accept(*pSocket);
pSocket->GetPeerName(sIP,iPort);
GetPeerName
Client Side:
m_pCLTSocket->Create();
m_pCLTSocket->Connect(lpszAddress, 1500));
I checked in the debugger the value of iPort which shows 4774. I am listening at port 1500 and connecting the client at port 1500.
Then what is the port number that is returned by GetPeerName(sIP,iPort) function?
|
|
|
|
|
This is the address of the socket at the client end, which will be allocated by the system when it calls Connect . Port 1500 is the port number at the server end.
Veni, vidi, abiit domum
|
|
|
|
|
Thanks a lot for the clarification.
|
|
|
|
|
in the function of undating,i need to obtain the version number which is getted from web server and set it to my software. could anyone show me how to set the version in code.
thanks!
|
|
|
|
|
Is this a C++ question, and if so what version are you referring to?
Veni, vidi, abiit domum
|
|
|
|
|
thank u,my meaning is replacing the version of my .exe with the one from server.
|
|
|
|
|
i found how to complete it.thx all the same
|
|
|
|
|
what was the solution ?
I'd rather be phishing!
|
|
|
|
|
use method UpdateResource
|
|
|
|
|
I am dealing with tons of functions, and i am using sendmessage and other macros as well, but somehow each time i use sendmessage the handles in taskmanger get increased, even using createfont as this
Hfont = createfont(.....)
deleteobject(Hfont)
but as i know deleteobject will delete the Gdi object, but what abut its handle? I am not sure why this happens, even this
listview_setitemcount(.....)
bty I am destroying my HWND object each time i use X button, so i make a new one (I have no problem with Gdi they all fine) except those handles? has anyone faced this?
Update; now 100% sure that using sendmessage(....) increasing my handles 1 time, but why?
modified 25-Sep-13 5:17am.
|
|
|
|
|
Just “discovered” that I can post a message into application main window from a secondary thread: AfxGetMainWnd()->PostMessage(WM_GRAPH, 0, 0);
No biggie, but I can also process the message using MFC PreTranslateMessage.
Still “so what?”
The catch is – the PreTranslateMessage “walker” starts in main app window and goes <b>DOWN the MFC </b>hierarchy and the message is eventually processed by correct object.
Just exactly the opposite what the doc say.
It does the work I need, but I wonder if my VC++ is broken again or is this normal?
Cheers Vaclav
|
|
|
|
|
Hi,
The documentation is correct. Note that 'PreTranslateMessage' is an MFC invention. Basically it boils down to this:
In Win32 each window has a default WindowProc callback function[^]. However the MFC does its own internal command routing. You should probably read some of the older MFC documentation from MSDN that explains it in detail.
Found one from Paul Dilascia (circa 1995):
http://www.microsoft.com/msj/0795/dilascia/dilascia.aspx[^]
Best Wishes,
-David Delaune
|
|
|
|
|
I am using sockets derived from CSocket
I am getting details about the client IP address and Port after calling Accept(socket).
Eg:
void CListenSocket::OnAccept(int nErrorCode)
{
CSocket::OnAccept(nErrorCode);
m_pSocket->Accept(*pSocket);
}
Anyone Please let me know if it is possible to know the details about the client IP address and Port before calling Accept(socket).
|
|
|
|
|
Perhaps this[^] link will help.
|
|
|
|
|
How to check outdated driver programmatically?
|
|
|
|
|
Check it for what specifically? A detail or three would be nice!
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Maybe this[^] link will get you started in the right direction.
|
|
|
|
|
You cant really since you have no idea just what it does at a functional level, however running it through Microsofts WHQL will tell you whether it is fit or not. You can also enable Verifier on it and select pretty much everything except Low Resource SImulationn.
If it fails these, junk it and tell who wrote it their product is garbage.
|
|
|
|
|
You can use GetFileVersionInfoSize() , GetFileVersionInfo() and VerQueryValue on a driver-file just the same way as a DLL/EXE.
It is a bit complex, but see here for an example.
Gisle V.
# rm -vf /bin/laden
/bin/rm: success
|
|
|
|
|
Dear All,
when its required explicit keyword in constructor? and what is the purpose?
Regards,
Ranjith
|
|
|
|
|
It is used to prevent the constructor to be used for implicit conversion, see explicit (C++)[^] for an example.
0100000101101110011001000111001011101001
|
|
|
|
|
Hey there,
I have the raw image data and now want to convert it to PNG image. How can i do that? The raw image data is stored in a unsigned char *.
I know how to convert it to Bitmap, but have no idea how to convert it to PNG.
Thanks in advance.
|
|
|
|
|
|
Hi,
If you are on the Microsoft Windows operating system and don't mind using the GDI+ library then you could use the Bitmap Class[^] which inherits from the Image Class[^] that has an Image::Save[^] method and can be used for image encoding[^].
Best Wishes,
-David Delaune
|
|
|
|