Network-Framework
Programming Language-: Python
Library Used-: JSON
One of my project named as MyNetworkFramework.
Anyone using this framework can build network applications without even implementing network programming/socket programming in their application. They are just required to follow some protocols which are written in documentation of the project. Other queries will be cleared after you see examples of implementation.
Developer using this framework needs to create a demo server file (which will act as server side script in his/her project) and a demo client file (which will act as client side script in his/her project).
Client Side
Developer needs to wrap the information to be processed in a Request type object (Netork_Common) has a script which has Request class. Developer can wrap info in Request Object and can send its JSON form using NetworkClient class.
Suppose developer working on a project of Student Management Application. So here manager part is : “Student Administration”. We need to add a student so here action parti is: “add” and we will pass an object of type Student which will contain all details of that student to requestObject part is “student_object”.
request=Request(manager= “Student Administration”,action= “add”,requestObject=student_object)
networkClient=NetworkClient() //creating instance of NetworkClient
response=networkClient.send(request) //sending request
That’s it now at server side request would have been received and according contents of request action would have been taken and respective response would have been sent. Which will be received at client side. And that it if all things were good and according to protocol student’s information would be added to Database/File or anywhere you want.
Server Side
Now at server side after request has been received. Developer just needs to use if-else statements to determine what action is to be performed and simply he can wrap that part of code in a function. According to project protocol developer needs to provide a Request Handling Function to NetworkServer instance so that server can process the request according to Developer’s requirement or needs.
Server will execute the Request Handling Function to process the request and create appropriate response to send.
Wrappers and Common Part
This part contains scripts of Request, Response and Wrappers which are required to wrap some particular type data and to perform validations in request and response.
I will soon provide its library and documentation with testcases(examples) (on github) of implementation of FrameWork till then enjoy the description.