|
But what Billar mean is that there is CAsyncSocket while there is already CSocket-class. So he wants to know why CAsyncSocket is also included?
And actualy I want it to know too.
By the way, if you want to use CSocketFile and CArchive, do you have to declare them too on a certain way, for using pointers to those type of class? Or isn't that necessary and just typ: CScoketFile *p_mSockFile //for example
Thanx!!
|
|
|
|
|
The CSocket is a higher level class than the CAsyncSocket.
It is easier to manipulate to serialize the data over the network. You dont have to care much about socket notifications, it does all the work for you.
But you also lose some flexibility.
You can use whatever you need for your application.
In order to use CArchive and CSocketFile with an CSocket you just need to create a CSocketFile object (on the heap or on the stack, as you wish)and give it a pointer to your CSocket object.
Then when needed you create a CArchive and you map it to a CSocketFile via its constructor and now you are ready to serialize your data on the network by just passing the archive to your serialize function.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
|
Billar wrote:
2. Although CSocket is derived by CAsyncSocket, but if possible please let me know the benifits and uses of AsyncSocket over CSocket.......
A CSocket object is harder to shut down than a CAsyncSocket object. It is harder to send and receive data, because the thread which is doing the work is tied up. Also a CAsyncSocket object does not require a separate thread.
Search the microsoft.public.vc.mfc newsgroup for the pros and cons of both.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Why are you implementing the client and server using two winsock wrapper classes?
Kuphryn
|
|
|
|
|
Both of them were written to encapsulate the old 16bit WinSock API. The API was primarily developed to provide non-blocking windows message based mechanism for socket IO since 16 bit windows was a non-preemptive multitasking OS. CAsyncSocket encapsulates the basic API while CSocket provides a blocking version of the same.
Today probably the only benefit in using them is to communicate across two MFC applications using serialization of MFC SERIALIZABLE classes. For any other socket use models you are better of using the Winsock2 API.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Dear All
Thanks for the information....
Here, in the above mentioned code, they have used thread. In the Client Program they call a User Message in OnAcceptMessage in both classes and start a TCPIP Thread, through where it send message to Server. Then Server checks for those messages and displays messages accordingly.
Here, instead of having thread I wish to Start a Server On Click Button and want to have a Client side which send messages to Server and Server performs just something on depending upon the message contents.....
If you r any having such idea or having an example of such kind of code please refer to me. Eagerly waiting for your help..........
Thanks once again to all in advance.....
Billar
|
|
|
|
|
I'm using the shockwave activex in my vc++ project but when I press keys into the editbox on the flash applet it loads, they don't show up. All that happens is I get a beep from my computer. However, it is recognizing when I press the arrow keys/tab etc, just not the main a-z 0-9 keys. It's definately not the applet, that works fine when I load it in explorer or from my old vb client. Any idea's?
|
|
|
|
|
int a:5;
I don't understand anything about this code.
Can u explain this code?
Please help me
Thanks...
|
|
|
|
|
From a long ago memory, its says to me that your declaring an integer which is 5 bits in size.
So you can have 31 to -32 as a possible range of values
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
Is it possible to use VERSIONABLE_SCHEMA with a CObList derived class? I remember doing this long ago and now I can't remember just how I accomplished this.
right now I have
IMPLEMENT_SERIAL(CCharacter, CObList, 2 | VERSIONABLE_SCHEMA)
...
void CCharacter::Serialize(CArchive& ar)
{
CObject::Serialize(ar);
if (ar.IsStoring())
{
...
}
else
{
UINT schema = ar.GetObjectSchema()
...
}
}
The schema variable is some large number and not what I expected which is one? Should I be doing this another way or this code flawed?
Thanks!
|
|
|
|
|
You need to do this after getting schema
schema &= ~VERSIONABLE_SCHEMA;
since you OR it in the IMPLEMENT_SERIAL
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Williams (Little Britain)
|
|
|
|
|
See this[^] series of articles if you'd like to implement robust general-purpose serialization yourself.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
how to make dll without mfc, but using "MFC Dll" in project wizard?
I just want to unlink it, cos i'm not using it
|
|
|
|
|
Why not a Win32 dll?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
But win32 dll needs mfc too. In all cases i have to include afx.h(if not? i have lots of errors, but code of dll does't need it, it only for creation of dll)
|
|
|
|
|
does anyone found mfc class wizard in vc++ 7.0 (visual c++.net) like in vc 6.0?
|
|
|
|
|
From what I've read, they are vastly different. I've read very few positive comments about VS7's UI.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The Visual Studio IDE is great. Is it different than older IDE's Yes. If it wasn't different then it wouldn't exist right? The Class Wizard in previous VC++ IDE's was OK at best.
IMHO just because you are used to something does not mean it is better than something else. If you don't like change your in the wrong line of work.
But, that just my opinion... I could be wrong.
|
|
|
|
|
I was also looking for the classwizard, to no avail. However there is still a way to accomplish everything you would like from the IDE. For instance, in the properties window, you can find the messages for a control and add a function for them from the control's property page. You might already know this, but I didn't and it took me a while to figure that one out, even how to change the id of the controls!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
when i run the following code in VC++ it gives "-1" as output.Why?
main()
{
printf("%d");
}
|
|
|
|
|
printf("%d");
You need a value associated with the format specifier:
printf("%d", x);
x would be some object in your code to be displayed in decimal format.
|
|
|
|
|
MSDN:
"The printf function formats and prints a series of characters and values to the standard output stream, stdout. If arguments follow the format string, the format string must contain specifications that determine the output format for the arguments."
Your format string is "%d" but no arguments follows that format string. so basically the printf function (knowing that it is a variable arguments function using a __cdecl calling convention) will take from the stack the parameters it needs (based on the format string "%d" you said i give you an int) and construct the string and send it as output
So the value -1 is a value the printf function is taking it from the stack.
Hope i kind of answered your question
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
If you want to output the string %d to the console then use "%%d", otherwise add the variable as someone has already suggested.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Williams (Little Britain)
|
|
|
|
|
You hve to have a value for it to display it would look like this:
main()
{
printf("%d", 2);
}
|
|
|
|