NDK Standard

NDK in an Extension DLL

Introduction

With the success of NDK 1.0, I decided to improve the functionality. NDK represents Network Development Kit. The NDK is a set of classes that implements a client/server architecture. The NDK hides all the complexity of the connection, sending, and receiving of data over a network. You only have to deal with three classes: CNDKServer, CNDKClient, and CNDKMessage. With just a few methods to override, you obtain a complete robust client/server application. The NDK is based on the class CSocket from MFC, so you can run your application on a local network or on the Internet without any change. To easily understand the integration of the NDK in an application, you'll find at the end of this article a complete chat application.

Comments and Discussions

I'm looking for someone that can help me implement a cheap but efficient corporate wifi network. I'm thinking about hotspots like switches where a can have a radius server for authentication, but a MAC address filter to keep load on the router the lowest possible. Is there anyone that can do that with a low budget ?

I'm looking for someone that can help me implement a cheap but efficient corporate wifi network. I'm thinking about hotspots like switches where a can have a radius server for authentication, but a MAC address filter to keep load on the router the lowest possible. Is there anyone that can do that with a low budget ?

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.

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.

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?

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.

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.

I am a telescope control system developing engineer. I use NDK to achieve the communication between telescope control program and auto-guider program. Because of the requirement of real time performance, I modified NDK a little bit, adding TCP_NODELAY flag bit to the sockets. It works.

If you would like to add this mechanism to your NDK as a minor upgrade, I perfer using yours.

hello, Sebastien_Lachance i downloaded your NDK_demo project and tried to run with two different computer making one computer as server and other as client.....i made a peer to peer connection, giving a mannual ip of 192.168.1.2 to host computer which i used to run the "chatServer" and 192.168.1.3 to another computer which i used to run "chatClient"...but even though the computer are well connected connection of chat from one computer to another was not possible

in the ip field of chatClient when i gave the ip 192.168.1.3 it couldn't connect to the chatServer even though it was running in next computer with ip 192.168.1.2

Please help me with this i really want to learn how client/server application really work

There is probably a Firewall problem, check your settings and disable the firewall on both computers during the test. Under the NDK, CSocket is used, so there is nothing fancy hidden. The NDK works for about 10 years.

Dear Sebastien,Your work is very good.Now I want to use it to receive the data from a experiment unit.The unit just uses an Ethernet interface in the board.It is just send out the data via TCP/IP and can not receive the message from server.I want to know how can I modify the codes to receive the data from unit?Can I receive the data automatic?Can you gei me some suggest?Thanks a lot.Thank you.

I'm sure that it is technicaly possible. The NDK is build on top of CSocket from the MFC library. I would suggest to you that you dive into the MFC classes. The CSocket hides the complexity of the TCP/IP.

Hi there, Would it be possible that the bugs discovered so far in the comments could be patched and the latest source code be updated in the article. I am having a trouble also when suddenly my client application crashes for no apparent reason (its a lan based chat client connected to a single server). If anyone can do the fixes in the source and publish it, that would be great...