|
??That doesn't sound right. What exactly does the Debug Assertion say. Is is occuring in MethodIwouldLikeToInvoke? I guess it must be. In which case you have another problem, your call is working but something else is not.
To export a class member function it must be public and you will need to export the class itself. For an example of how to do this generate a new Dll with the VS2005 Wizard and choose 'Exports Some Symbols'. That will give you a commented example of how to do a variety of exports.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Yes, it is occuring in MethodIwouldLikeToInvoke, there's something wrong with my MessageBox statement. If I put some other code in the MethodIwouldLikeToInvoke, it is executed properly. I still have a problem left, but I will start a new thread for that issue. Thanks a lot for your help!
|
|
|
|
|
How can we know that the buffer of the Socket is full or not?
Anyone Please provide help.
Thanks and Regards,
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
In my experience you know when a socket buffer is full because things start to go badly wrong. A full socket buffer is not something you want to be waiting around for or in fact ever see. Best to avoid it if you can. Filling socket buffers on Win9x will frequently take down the whole operating system and the process on Windows NT. The fact that it took MS 3 versions of Windows to stop this being a total disaster area tells you all you need to know. Don't go there
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
But i want to stop sending messages when buffer gets full because when buffer gets full client closes the connection.
Any idea?
Thanks in advance
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
My point is that you need to stop sending messages BEFORE the buffer gets full because once it's full it's too late, data is already corrupt and the connection drops. Ultimately the only reliable way I've found to do this is to make sure that your client reads messages faster than your server sends them so the buffer never fills up. The client should probably have a dedicated thread or threads servicing the socket connection and placing the messages recieved into a queue in memory that you control. If the queue gets too long the client will need to tell the server or find some other way to cope.
Your server will ultimately be talking to more than one client right? over a limited speed network, so there's no reason your client can't keep up with the traffic your server can send it as long as it can handle the full network bandwidth. On average it will only need to handle a tiny fraction of this as the bandwidth is shared.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thats true but my client is flash and it automatically sending and recieving messages.
So i cant control client. So let me is there any way by which i can come to know that buffer can accept only some amount of packets.
Is it possible??
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Only if there is some indication within the protocol that Flash is using. Does it send acknowledgements? You could count the mismatch between messages sent and acks recieved and see what the limit is before Flash goes Bang. Then stop sending whenever you've sent x number more messages than you've had acks for. This will require a bit of trial and error to get right, keeping track of messages sizes etc. Other people must have had this problem with Flash. You could look for a Flash specific forum where you might get better help. I'm afarid I've never used Flash or written a socket server app against an exisitng 3rd party black box client. Good luck
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
You know you're getting ahead when send() returns less bytes sent than you
requested to be sent (it may even return 0 if the send buffer is completely full!).
You should always be checking the return value so you can resend unsent bytes.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Matthew Faithfull wrote: A full socket buffer is not something you want to be waiting around for or in fact ever see.
What? Do you have a link?
I've been overstuffing stuffing sockets since before Win95 and I've NEVER heard anything like that.
If you ignore unsent bytes then chances are real good that the app-layer protocol is going to be f*cked
but I've never heard of a problem below the app layer of the protocol stack.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Matthew Faithfull wrote: It's not sending but recieving buffers that are the problem.
Ah, gotcha. I've always made sure to cache incoming data if there's a chance it will come faster
than I can process it - not because of problems, just because "keeping the pipe clean" is most
efficient for the protocol. If the protocol implementation is working correctly, a full receive buffer
should just shut down transmission until there's room to receive. At the app layer, both ends need
to deal with that - usually by simply always checking the send()/recv() return values
Regardless, I think the OP has a design issue or just is using the APIs incorrectly. It's hard to tell
with such little info, but usually one has to do something wrong to get a TCP connection to terminate
unexpectedly. Hmm...is (s)he using TCP? hehe
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello everyone,
I sometimes saw code with template<> and followed by a class definition, like,
<br />
template<> class {<br />
<br />
}<br />
I am wondering the practical usage of this trick. Why declar a template but leaving the content to nothing? If there is no type parameters, I do not think there is a need to put template<> statement.
thanks in advance,
George
|
|
|
|
|
Why do you put the () if the content is void?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Thanks Nelek,
I do not quite understand your points. What do you mean *() if the content is void*? I am not putting (), I am putting <>.
regards,
George
|
|
|
|
|
void main (void) == main ()
why to put the () if there is nothing inside?
You know the answer, dont u?
This is what I wanted to mean, just remake the question with <>
if you dont put the (), how does the compiler differenciate between variables and functions? if you dont put the <> how does the compiler differenciate between templates and other things (i.e. Typedefs?)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi Nelek,
My question is not about the syntax of template<>, but I can not see any practical usage of this trick. Could you list some practical usage of template<> please? I think if nothing is in template<>, we can remove the template<> declaration.
Please feel free to correct me if I am wrong. Thanks.
regards,
George
|
|
|
|
|
Ok, then I missunderstood your question, please report to cedrics answer
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
No problem Nelek, my question is not always clear.
regards,
George
|
|
|
|
|
You probably saw that in a template specialization case. But, normally, the name of the class should be followed by the specialized type.
Check here[^] for more information about template specialization.
|
|
|
|
|
Good link, Cedric!
My question is answered.
regards,
George
|
|
|
|
|
what is the different between the declaration of a variable in the header file and the declareation in the .cpp file?
For expamle, in my program I need an object "helpUIDCache" to contain a value before all functions run. and after the run of all functions I'll delete it in deconstructor.
in constructor:
static bool isCreatedCacheFile = false;
if(!isCreatedCacheFile)
{
helpUIDCache = new HelpUIDCache;
if (!helpUIDCache->createTestFile())
{
CPPUNIT_ASSERT_MESSAGE("Error in helpUIDCache.",false);
}
isCreatedCacheFile = true;
}
if deconstructor:
static int numOfFunctions = 0;
numOfFunctions ++;
if (numOfFunctions == 8)
{
wprintf(L"backup file name: %s\n",helpUIDCache->getBackupFileName() );
helpUIDCache->restoreCacheFile();
delete helpUIDCache;
}
If I declare "HelpUIDCache* helpUIDCache;" in the header file, in deconstructor the attribut of the object helpUIDCache is null, by wprintf I can not get the file name from it. But if I declare it in .cpp, the attribut contains its value in deconstructor. so what is the scope of the variable declaration in header and in .cpp file?
thanks in advance!
|
|
|
|
|
Are You getting Attributes of object in Constructor?
Check it first.
Thanks and Regards,
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Yes. I can get the attributes in constructor.
|
|
|
|
|
Then declare your class variable in header file as public and initialize it in constructor and ckeck this variable in destructor is it null or not?
I think if itis not null then you can access its members, no problem with it.
Manish Patel.
B.E. - Information Technology.
|
|
|
|