LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Understanding the client-server architecture for implementation (https://www.linuxquestions.org/questions/linux-networking-3/understanding-the-client-server-architecture-for-implementation-4175543836/)

intellectualBeard 05-28-2015 05:37 AM

Understanding the client-server architecture for implementation
 
Hello,

I found the introductory article on YouCompleteMe (http://www.alexeyshmalko.com/2014/yo...lugin-for-vim/) where the author mentions that it incorporates a client-server architecture, where seperate engines for various languages are there on the server side (https://github.com/Valloric/ycmd/blob/master/README.md).

I cannot understand the following:

Q. How does the query get generated and then sent to server? What is the protocol used there?

<General question: >
Q. How can a new C-library be used in a server?

I am trying to build a simple editor of my own in Java and wish to integrate another C-library with it without using a wrapper. I also wish to improve my understanding of the client-server model.

Any help will be appreciated.

Thanks in advance. Noob alert.

rtmistler 05-28-2015 07:21 AM

Client-Server architecture is that you have one element sending requests and receiving responses via a messaging protocol of some type, typically a network stack. That first part is the client. The client does not have to be running and ready all the time, it runs when needed, such as a user runs a program and looks for some type of data, then it issues it's requests to the server.

The server should be running all the time to be ready to provide responses to requests from one or more clients. The client-server model is such that the server should be capable of responding to multiple clients. The server can be on the same machine or on a different machine, or somewhere out in the Internet. In the article you've been reading, the server happens to be on the same machine. The model is the same though, the VIM client will issue requests to the server to satisfy it's needs to do auto-complete.

The query gets generated when the client software determines it is the right time or conditions to need information from the server to provide more auto-complete options. So it depends how the author wrote their client code. What protocol is used is also chosen by the author. In networking you can use raw Ethernet packets, or choose to use one of the common transports, such as TCP or UDP, and there are unassigned protocol port numbers within both of those transport protocol numbering schemes where the programmer can choose something unassigned. You'll have to read up on network protocols if you really wish a deeper understanding of it. These ports I'm talking about are just numbers in the protocol header which designate a type of communications. For instance there are port numbers assigned for communications types like FTP, TELNET, L2TP, and so forth. There are also many unassigned port numbers where the client-server author can choose one of those to communicate over the IP network and thus each side can be able to screen the IP traffic and find the packets relevant to this particular client-server session.

A new C library can be used in a server when you build the code which is the server and use this new library. It's not like you install or do something to an existing server and things are all set. When you talk about a code library, you really have to build the code, which is compile and link the code so that it will understand the new library. Also this new library needs to provide the proper, expected interfaces which were there in a former library, otherwise the build and link will not work.

I don't know how to integrate a Java app with a C library, or if that's even possible. Java is an interpreted language which uses a virtual machine to run the Java code you've written. Really not sure you can combine that with a C library. Perhaps someone else has thoughts on that.


All times are GMT -5. The time now is 03:15 PM.