Socket programming - serialization [closed] - c

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have read through Beej's guide, as well as many other resources I've been able to find on the internet, but I feel like I'm missing something in terms of serialization and de-serialization. I can sort of hash it out by hard-coding in a definite structure for the server and client to send/receive, but I wonder if there are any resources that I could look at which might help me to serialize more efficiently or generally, something that would help me to possibly re-use some of my serialization code in other programs instead of having to write custom-made serialization functions for every data structure that I want to pass around?

Google Protobuf might be useful to you, specially if you might want to consider a cross platform application implemented in multiple programming languages.
Protobuf has the serialization implemented already, so you would have that going for you.
As the above link is for c++, this is the c pendant.
But there are also implementations for many other languages, like Python, PHP, Java and many other!
Another C Protobuf library is nanoPB, thanks to πάντα ῥεῖ for pointing this out. It seems that this one is stable.
Another way would be to use another serialisation library to serialize and deserialize your data.
The last possible way would be to implement the serialosation by yourself, like it is described on this SO question.

Related

How can i implement concurrency in C like we do in go? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I would like to implement go's concurrency in C because I have seen that it increases the [performance] of go. I have not tried anything because I can't understand what to try. How can I do that?
Coroutines are not available in C natively (although they're supported in C++ starting with C++20), so you're going to rely on external libraries or you'll have to implement something yourself.
Some useful resources: an example by Simon Tatham, another small example, a C library called libaco, an interesting article with an alternative approach.
Another approach could be using an event-loop, that is the same approach used by JavaScript to implement concurrency within a single thread. One of the most used libraries is libuv and here's a small example of using libuv.

Is there a way to understand what algorithms does PostgreSQL use to implement relational operators without having to read the source code? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
PostgreSQL makes use of intraoperation parallelism and that is of interest to me (for my undergad final year research project). I would like to know how operations like selection, projection, join, etc are parallelized, but when I tried to look at the source code, I got extremely overwhelmed. Is there a high-level PostgreSQL "map"?
I tried looking for books that discuss and explore the algorithms and implementations used in PostgreSQL, but unfortunately didn't find any. Though feel free to refer me to such a book if you know about one.
If the only option I have is to dig into the source code, how long would it take me to find the information I want? And if any of you have gone through the source code, what advise would you give to me?
The nice thing about open source is that there is no clear border between the source code and the documentation, since both are public. As soon as you get deeper into the implementation details, you will start reading the code. Fortunately the PostgreSQL code is well written and quite readable.
The first stop on your way into the source are the README files. These describe implementation principles, algorithms and code rules at a higher level. In your case, you should start with src/backend/access/transam/README.parallel.
Another good approach it to read the patches that introduced the feature, like 924bcf4f16d, 7aea8e4f2daa, d1b7c1ffe72, f0661c4e8c44 and 80558c1f5aa1. That introduces you to the places in the code that are concerned with parallel query and gives you an idea how it all works.

How do i create an interface for C Game [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I just created the "Hangman game" using C language, i used GCC to compile it and worked in the terminal.
Let's say that i started with C a week ago, and this is the only programming language i know (Html & CSS arn't programming languages even if i know them). I'm a complete beginner so.
My question is, from the code source i have, how can i create an interface, an app that i'd start on windows (instead of linux terminal), with "buttons" or something like that ?
If i can't do this from the code source, what wold u recommend ?
What would be the software i should use instead of visual studio code to write code (because i guess i'll need a specific software if i want an interface or if i want to compile it in order to ceate a windows app ?)
I'm not english native so i may did some languages mistakes, sorry in advance.
Let me know if i can be more precise and explain something using other words.
There are numerous libraries and frameworks which can provide a GUI for your games.
Qt
Dear IMGUI
libsdl with widgets
and many more, depending on your requirements
Related posts:
https://gamedev.stackexchange.com/questions/1086/what-c-gui-library-can-you-suggest
Game GUI framework
http://samirsinha.com/choosing-a-gui-framework/
It's probably best to study existing games and how they are designed, what libraries people use, and so on, before embarking on building your own from scratch.
Also try reading some of the resources in the GameDev Stack Exchange.

What are the best languages to integrate with C for networking? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm making a project on BeagleBone, and I write most of my program with C. However, socket programming in C looks more complicated than it should be, so I want to use another language for networking in my project. I thought of using C#, but I can't find any good tutorials abouts sockets in C#. What language would you recommend in such case?
You simply need a higher-level library, not an entirely different language.
C is extensible through libraries; if you don't like the basic BSD socket API choose (or write) a wrapper library with an API you are happier with. If you are using application layer protocols you probably want to do that in any case - the socket API accesses the transport layer (layer 4 in the OSI model) which is probably why you perceive it as being complicated from an application layer perspective.
There are many libraries that provide network services on top of the socket API. There are even more if you use C++ which is entirely interoperable with C code. If you were prepared to interoperate with another language in order to get network support, you might consider using C++ rather than C in any case and avoid any interoperability issues.
Take a look at the "question" Best C/C++ Network Library for a list of C and C++ networking libraries.

Tips for using Google when looking for C stuff, rather than C++? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Whenever I'm trying to Google something like (random example) c udp networking library this is the kind of thing that pops up:
Simple Reliable UDP C++ Libraries - Stack Overflow
Networking Framework for C++ (UDP or TCP)? - Stack Overflow
open-network - A clean, object-oriented network-library for C++ ...
That is, Google thinks I'm interested in C++ pages for this query. I'm not. Is there any way to guide Google towards C pages, rather than C++ pages?
Try
c udp networking library -"c++" -"C#"
You can add the following expression:
-"C++"
in your search string.
-string
is used by google to filter out the unwanted pages. See here for other tips
You can help hint that you want C only by surrounding it in quotes like so:
udp library "C"
While this doesn't completely solve this nagging problem, it does HELP in SOME searches.
Usually, more C-specific results will be in the first page, and in some cases, where you usually only get C++/C# stuff, you'll get one or two proper C results.
also notice that putting "C" at the beginning or the end doesn't always prioritize results the same way... (try both ;-)

Resources