 |
|
 |
i had test the demo on the windows xp OS , in the client side, when i press the "send big message" button , it's about 4-6 seconds later, the server display the message " get the big message", i think NDK can not using in data amount huge and time harsh application. are you think so?
I use NDK in my application. on the server application I get data from a capture card, i want use NDK send there data to all connect client( at present, only one client ). the data amount is very huage ( about 5.2 MB/seconds), i found that there are very serious block problem. i think it may be that you using MFC CSocket class as the base class of the NDKClientSocket. CSocket using a CWnd delieve socket message, it is very low efficiency. i think you should re-write the CSocket layer to fix there issue.
|
|
|
|
 |
|
|
 |
|
 |
I had check your transfer file demo. I also changes the MAX_BUFFER to 1024*10 and 1024*1024, I use your demo transfer a file about 43MB( both server and client run on the same PC ), it cost me more than 10 minutes. it seem that NDK have low transfer efficiency.
I check your code, I think you using the CSocket as your base class, it will cause the low transfer efficiency. becuase CSocket using a hide window class CWind as its message routine, if we want much more data transfer speed , this kinds of message routine is not enough.
in order to get the max transfer speed, I think you shouldn't using the CSocket as you base class.
|
|
|
|
 |
|
 |
I started the NDK in 2000 and I did an update in 2006. For sure, there are new technologies to transfer files.
Good luck
ArchieCoder
|
|
|
|
 |
|
 |
what is the difference of add() and setid() in CNDKmessage?
can they be used in the same way?
thanks
|
|
|
|
 |
|
 |
The add() is used to add more than one element in a message.
The setid() is not required if you create a new CNDKMessage everytime.
|
|
|
|
 |
|
 |
I'm sorry.I wrote a wrong word yesterday. i mean what is the difference of add() and setat() in message?
can I write code like this:
CNDKMessage msg;
int nID = 0;
CString strTemp = _T("temp");
msg.add(nID);
msg.setat(2, strTemp);// I did not setat(1,xxx);
thank you for your help!
|
|
|
|
 |
|
 |
Hi,
I do not remember. The best thing is to try it. But I think msg.SetAt is to replace an existing element previously added with the Add method.
ArchieCoder
|
|
|
|
 |
|
 |
hi,i got it!I will have a try.In fact,if I aways use add(),I was worry about memory leap.
thank you! if there is something wrong, I will write here.
thank you for your great work!
|
|
|
|
 |
|
 |
I'm curious, what kind of app are you doing?
|
|
|
|
 |
|
 |
oh , I'm just writing a simple c/s app for translate files.When I read your source code, I came to this question.
In fact,there was another question about thread, when i sendmessagetoserver(),app will crash.I haven't resolve it yet.Since it is about thread and you have answered this kind of questions, i'm trying my best.
sorry for my poor English.
thanks again
|
|
|
|
 |
|
|
 |
|
 |
Hi Sebastien_Lachance
I'm reading your article that you wrote 10 years ago about translating files(sorry, i spelled a wrong word )
thank you for your excellent work!You gave great help to me.
bzcode
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
thanks for your job!i vote 5!
my question is : on the function OnConnect(long lUserId),i can get the client's computer name with
CString strNickname;
message.GetAt(lUserId, strNickname);
but how can i get client's ip?
thanks!
|
|
|
|
 |
|
 |
Hi,
There is a method on the NDK for that: GetIpAndPort.
Good luck
ArchieCoder
|
|
|
|
 |
|
 |
hi,thank you very much for your answer!
but the mathod GetIpAndPort() is only for client.
i mean the how can server get the client's ip on mathod on function OnConnect(long lUserId)?
thanks!
|
|
|
|
 |
|
 |
This actually will look pretty similar to in the client implementation. However, if anyone still is wondering how to do this... These snips are moving from the socket class up to the server container. You can just copy in CNDKServerSocket::GetIP() and the accompanying pass-through functions, then call CNDKServer::GetIP(long lUserID) some time after a user is connected to get their address. Hope that helps. CString CNDKServerSocket::GetIP() { if (m_pServer != NULL) { CString strSocketAddress; UINT unPort = 0; GetPeerName(strSocketAddress, unPort); return strSocketAddress; // Return Client IP } return _T(""); } ... CString CNDKUser::GetIP() { if (m_pServerSocket!=NULL) return m_pServerSocket->GetIP(); return _T(""); } ... CString CNDKUserManager::GetIP(long lUserId) { CNDKUser& user = GetUserFromId(lUserId); if (user.GetId() > 0) return user.GetIP(); return _T(""); } ... CString CNDKServer::GetIP(long lUserID) { return m_userMgr.GetIP(lUserID); }
|
|
|
|
 |
|
 |
Hello, Thanks for your great work.
I use NDK to transfer a big buffer as big as 2.5MB for one time.
But the transfer speed is very slow, about 2 minute. Even I use the very fast computer, it is also very slow.
When I use another normal computer, the program is working very fast. Transfer a big buffer as big as 2.5MB just use less than one second. I don't know why, Can you explain it for me?
If there is some net configuration i can do for it?
|
|
|
|
 |
|
 |
Hi,
Thanks for the comment. My first bet is an hardware limitation on this particular computer. I read in your previous post that you use a unit to send data right?
However, could you try to split the big buffer in many little messages? Check my article Simple File Transfer Using the NDK: Simple File Transfer Using the Network Development Kit 2.0[^]
Let me know if it is working if you split the big buffer.
Thanks
ArchieCoder
|
|
|
|
 |
|
 |
Yes, I can do that, and if I split big buffer into as big as 20KB, and the speed is fast, but not as fast as in my own computer and send the big buffer as 2.5MB, I think if you can know some method to modify the configuration on net.
Thanks a lot for reply.
|
|
|
|
 |
|
 |
Hi
I would say that if it is still slow, I would suggest you to search for tools to analyze the speed at a lower level on your network card. I do not have a name in mind, but I know it exists.
Is there any special firewall or anti-virus running?
Good luck
ArchieCoder
|
|
|
|
 |
|
 |
The firewall is shut down. Yes, if i split the buffer in small size, the speed is more fast.
but it is not as fast as when i use my own computer and make the size of the buffer as 2.5MB..
How wired~
Thanks for replay.
|
|
|
|
 |
|
 |
Hi again!
For curiosity, what kind of project are you doing?
Thanks
ArchieCoder
|
|
|
|
 |