|
Hi, me again
I've tried porting the code for the dll version for NDK from visual studio 6 to embedded visual C++ 3.0. After resolving a few include file and TRY CATCH exception syntax issues, I'm stuck cause the compiler gives me the error that in the afxdllx.h file, the AFX_MODULE_STATE is an undeclared identifier. I've looked very hard at MSDN and there seems to be nothing wrong....anyone who has a good explanation for this?
Regards
Yap Ing Looi
Singapore
|
|
|
|
|
Did you replace CSocket by CCeSocket?
|
|
|
|
|
Yes,I've tried that. Apparently Csocket is still supported in WinCE embedded visual C++ according to MSDN. So I tried out both ways. However the same error still occurs.
This are errors I got...main source is 1st error.
ERRORS WHILE COMPLIING
-----------------------
:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(60) : error C2065: 'AFX_MODULE_STATE' : undeclared identifier
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(60) : error C2065: 'pModuleState' : undeclared identifier
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(60) : error C2065: 'AfxGetModuleState' : undeclared identifier
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(60) : error C2106: '=' : left operand must be l-value
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(61) : error C2227: left of '->m_pClassInit' must point to class/struct/union
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(61) : error C2227: left of '->m_classList' must point to class/struct/union
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(63) : error C2227: left of '->m_pFactoryInit' must point to class/struct/union
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(63) : error C2227: left of '->m_factoryList' must point to class/struct/union
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(65) : error C2227: left of '->m_classList' must point to class/struct/union
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(65) : error C2228: left of '.m_pHead' must have class/struct/union type
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(67) : error C2227: left of '->m_factoryList' must point to class/struct/union
C:\windows ce tools\wce300\Pocket PC 2002\mfc\include\afxdllx.h(67) : error C2228: left of '.m_pHead' must have class/struct/union type
C:\Documents and Settings\Vetronics\Desktop\NDK\NDK.cpp(14) : error C2146: syntax error : missing ';' before identifier 'NDKDLL'
C:\Documents and Settings\Vetronics\Desktop\NDK\NDK.cpp(14) : fatal error C1004: unexpected end of file found
Error executing clarm.exe.
NDK.dll - 14 error(s), 0 warning(s)
Thanx for the swift reply.
Yap Ing Looi
Singapore
|
|
|
|
|
Try that, copy all NDK files into your project. Don't use the DLL project.
|
|
|
|
|
Hi, I've managed to create the NDK dll(without the Chat Server or Chat Client exe files). Problem here is that when I try to register the dll in pocket pc 2002, it gives me the following error :
"ndk.dll was loaded, but the dllregisterserver entry point was not found.
DllRegisterServer may not be exported, or a corrupt version of ndk.dll may be in memory. Consider using PView to detect and remove it."
The reason I need the dll is that I am trying to use the same structure for NDKmessages to link with my server PC. However, my client application is VB Based and although I can link using VB, I need the NDK format. thus I tried porting the dll over.
However I'm still unable to use this route...any suggestions?
thanx.
Regards
Yap Ing Looi
Singapore
|
|
|
|
|
Hi, just tried directly calling the dll without registering it, but it seems that the application is unable to load function.
2 errors are given:
Unable to load function or
Invalid Procedure Call or Argument.
IngLooi
Singapore
|
|
|
|
|
The DLL does not need to be registered.
I don't think that you can load the CNDKMessage class in VB.
In VB, you can call standard function from a DLL but you cannot call method of a class. That's what I think.
|
|
|
|
|
Hi Everyone
I am developing a server based chat application , there is also a direct client to client file transfer , just MSN File Transfer.
This is easy when two parties are directly connected to internet with dial up in this case they both will have unique ip.But the problem is if supose one client is using internet with LAN sharing and other is connected to internet through dial up then , so for the first one we can only get the ip adress assigned to net server to which we are connected with internet , not the machine which is connected with it through LAN , so no direct client to client connection.
But i know MSN messenger is doing it so there must be some way doing this . CAN SOMEONE HELP ME ABOUT THIS
|
|
|
|
|
It's simple ! Use direct connected machine as the server and do server-to-client transfer..
|
|
|
|
|
I don't know "How you can transfer files between Client-server on LAN" it take my 6 weeks.
Please help me
Thanks
|
|
|
|
|
Hi,
when using the client and the server on one PC with sending many, many request to the server the PC gets memory problems. I used the sample program for the NDK and modify only the client:
OnButtonSend()
{
for(;;)
SentMessageToServer(message);
}
Memory usage is increasing. What can I do?
Any ideas what is going wrong?
|
|
|
|
|
Buy more Memories!
Windows keeps all buffers until the server process all messages.
|
|
|
|
|
How can i change the Connection from TCP to UDP?
|
|
|
|
|
In the method Create of CSocket uses the define SOCK_DGRAM
|
|
|
|
|
Thanks
|
|
|
|
|
In both OnReceive() functions in NDKClientSocket.cpp and NDKServerSocket.cpp I added these lines:
// Called when data is received.
void CNDKClientSocket::OnReceive(int nErrorCode)
{
CString str;
UINT ui;
//remove read notifications
VERIFY(AsyncSelect(/*FD_READ | */FD_WRITE | FD_OOB | FD_ACCEPT | FD_CONNECT | FD_CLOSE));
...
//reset notifications to default
if(0 != GetSockName(str, ui))
{
VERIFY(AsyncSelect());
}
}
I was having problems with the ASyncSelect being fired even if the socket had been deleted because of a termination of a connection. In my game (http://www.settlers3d.net) this was showing up as people having problems with the game crashing after they had played one game and then tried to connect to another. I couldn't figure out a great way to resolve this, but adding the GetSockName() call seems to work because this CAsyncSocket function call seems to still be valid even if the socket has been deleted and it returns 0. Others may have a better solution, but I posted this to at least get some feedback on it, and perhaps someone else will think of a better way.
|
|
|
|
|
Such fix already was posted. It not solution. Cause we lose about 90% of speed.
|
|
|
|
|
With my initial protoco design, I have been passing data via the primitive data field types (strings, int's, etc). The basic logic flow requires me to:
1) Deconstruct the object and assemble the varying field values into a CNDKMessage.
2) Send that message to the server and reconstruct the object on the server side.
3) Do some processing.
4) Deconstruct the object again assembling its different values into a CNDMessage and send it back to the client.
5) The client then takes the message fields and recontructs the object with the new values.
<sigh>
I have been looking at the CNDKMessage that will allow me to pass an entire send an entire object (LPVOID,UINT size).
This would make it much more convenient to just send the entire object without having to compose/decompose it's primitive elements.
I don't see any troubles with this. But am I missing some design considerations here? The only one that I can think of is that this may cause troubles when producing a cross-platform client.
How does everyone else generally do it? Do you usually just send the entire object, or do you decompose your protocol into primitive types of integers and strings?
Thanks in advance.
Jim
QTExtender - The OFFICIAL addon for QuoteTracker.
|
|
|
|
|
I decompose the message into primitive types.
Sébastien
|
|
|
|
|
Hi Sébastien,
Is there a way to get the OnIsConnectionAccepted() function to behave in the same fashion as if the server were not running?
If I return FALSE, the clients still appear to connect but they cannot send or receive messages and in some cases, using the GetNbUsers() function to limit the number of users has caused my server to crash.
Any ideas?
Thanks,
Don
|
|
|
|
|
Hi,
Please remove the line ASSERT(GetNbUsers()) in the method OnIsConnectionAccepted.
It should work now.
Sébastien
|
|
|
|
|
Hi Sebastien,
Thanks for getting back to me. Unfortunately, I'd already tried that. All I use doing in the OnIsConnectionAccepted method was the following:
if (GetNbUsers() > LicenseCount)
return FALSE;
else
return TRUE;
Fortunately, I found a better way to accomplish the license limit. I always return TRUE in the above method and go ahead and let them connect, then I test the number of users in the OnMessage method when they've joined. If they've exceeded the license limit, the server sends them back a license error message and the client informs the user, does a CloseConnection(), an OnTimer event is started, and it will attempt to reconnect in x milliseconds (defined in a registry setting).
This gives me a little more control over what's displayed to the user on the client side, and the administrator on the server side, where I can use the AddSystemText method to display what just happened. It shows that the user attempted to connect, but that only x number of users are able to connected with this particular license, then lets the admin know that it'll be disconnected, and then you see the user leaving the server. It all happens within a fraction of a second of course, but it's perfect for what I was trying to accomplish.
I'm not sure why the OnIsConnectionAccepted() method wasn't working. Probably something I've done. Anyway, thanks again for this great class!
Cheers,
Don
|
|
|
|
|
hi everybody! (hi doctor nick! )
ok, herez the thing.. i'm working in MFC for one year, but i've never worked with sockets yet (except with VB, which is kinda gaay..JK ).
i'm planning to make an instant messenger on this concept:
app consisting of server and clients. server accepts new connections, establishes a new connection with the requesting socket and voilá - chat. also, when my users want to connect to somebody's server, program creates a new socket and voilá - chat. so, herez how i immagined it, but i seem to have no ideas how to implement this , and now i'm hoping someone here will help me with those ideas..
user is able to exchange messages with many users at the same time, but they talk separately.(like...icq, msn, yahoo messenger..). each connection should have its own dialog, with separate properties. there is a main dialog which would basically organize everything (accepting connections, taking care of the existing ones, cleaning up when shutting down, holding contacts..).
and that's just basic stuff. how do i search the net for online users?? if a user wants to search for his frend, how do you that? and do i search by machine name or...HOW...!?!?
I'd just like to say that i'm not asking for the code (not jet )), just for the concepts how this is done. i've never done anything like this, and i'm clueless..
oh and, thanx everybody, this site has a GREAT community..
t1
---
kick ash.
http://t1tan.cjb.net
|
|
|
|
|
Hi t1,
I was in your shoes about six months ago, still don't know dookie about client/server winsocks and such, but this class will definately send you in the right direction, if nothing else.
My advice is to take a little time and play with the demo. Everything is documented pretty well and you should be able to do all of the things that you mentioned here.
I believe someone had asked the question in one of these previous posts on how to get the list of users to a client, and the answer was to put them into an array and send it back to the client from the server. You'll have to see the post for more information on that question in particular, but basically, your client would send a message to the server containing the users name that you're seeking (or request the complete list if you wish), and then the server could look up the name and return a TRUE or FALSE (or whatever you want) letting you know whether the user is connected or not.
You could also set up new messages to be shared between the client and server, in which the client would tell the server which userid to send the message to, and then the server would simply take the message apart, see who it's supposed to go to, put it back together, and send it to that user, and vice versa. If the user isn't connected, the server could send a message back to the requestor letting them know.
One thing to note (something that got me) is that the messages you define have to be in order and identical on both sides in ChatMessage.h (in your client and server). I was banging my head against the wall for a few days with this one, until it dawned on me.
Hope this helps, or at least encourages you to press on. It's a little intimidating at first but if you take a little time and familiarize yourself with the NDK functions above, you'll be chatting and winsocking in no time!
Cheers,
Don
|
|
|
|
|
everything's kewl, except for one thing: i was planning to make a peer-to-peer app, so there should be no central server at all. that's when i get into trouble of getting the "online users list" - where to get it from?? how do the programs like kazaa & winmx do it? (as far as i know they don't have any server??) and how do you manage everything (dis)connections if there is no server?? and how to connect two "clients" (i.e. no real server)?
thanx for the rest of the tips, i'm sure they will prove usefull
there is one more thing i could ask here.. if i create a dialog resource, and inherit it from CNDKServer/CNDKClient, is that more practical then creating a public varible of the same dialog class??
that's it, i've already said too much ...
tnx
t1.
---
kick ash.
http://t1tan.cjb.net
|
|
|
|
|