Git Product home page Git Product logo

trj's Introduction

Hello world!

Pablo Corbalán de Concepción (@pablocorbalann everywhere)
bachelorship student in Murcia, Spain with a broad interest in pure sciences and software.

trj's People

Contributors

pablocorbalann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

trj's Issues

Translate the README.md file to your language

If you are looking for a good project to start contributing to the world of open source, this issue is for you.

You can translate the README.md file of this project into your language, and put it in the doc/ folder after making a pull request.

The name of the new file must be: README-lang.md, for example README-es.md.

Good luck!

[S] Add a timeout for closing the clients if they do not respond, but not raising before connecting.

One of the things that would be nice to be implemented would be a timeout to close and completely expel the clients when they take more than X seconds to respond, for example, 10 seconds.

I have tried to implement a small timeout on the server before receiving the messages. When the server sends a command to be executed on the client, the client sends a response message to the server, something like command "command" has been received on the client. My idea is to implement the timeout before the server receives this confirmation from the client, something like:

# When declaring the server inside the server/server.Server class
self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.server.settimeout(10) # 10 seconds timeout
self.server.bind(addr)
# The rest of the code...
# In the while loop that receives messages from the clients:
try:
    # ... The code that goes before receiving the confirmation from the server
    client_confirmation = client.recv(self.MAX_BITES).decode(self.DCF) # DCF stands for DeCode Format
    cdr.append(client_confirmation)  # cdr stands for client data register
    print(f"{client.__repr__()}: {client_confirmation}")
    # ... The code after receiving the configuration
except socket.timeout as _:
    # The code that should remove the client from the server
    pass
All these code snippets are located in this file

The fault is that when I try to implement the timeout, it is also activated when a new client does not connect for more than 10 seconds. This makes the timeout to be raised every 10 seconds:
raised
Some pieces of code from the actual state
Screenshot from 2021-03-07 16-20-09

Declaring the server

Screenshot from 2021-03-07 16-21-15

Handling the timeout

Remember to read the contributing.md file to solve this issue

[S]: Upgrade the server so that it can manage more than one client at the same time without bugs.

I've been working on trj for a couple of weeks now, and right now it works quite well when only one client is connected.

example-1

Example of how trj works with a single client on localhost

However, when you try to connect more than one client simultaneously to the server, it begins to generate small bugs such as eliminating the option "choose what you want to do" disappears suddenly although you can still type the number related to the option you want.

See the example in the photo below

example-2

It is quite a complex issue, since the server uses a fairly large thread system so the bug could be anywhere. Good luck!

json-c errors when compiling an small implementation test

Trj is a project with which I am learning C, so before implementing a new function I try to create a small "test", especially if I don't know where to start with this new feature.

When I was working on this little test to read a json file from the client (later this feature will be used) I can't compile the test file correctly using the @json-c library.

You can check out the branch here.

The purpose of the test is to be able to load a json file very easily, the file is this one

{
  "name": "Pablo",
  "age": 15,
  "friends": ["steve", "alex", "susan"]
}

If you can modify the file so that it is able to read this json document and compile it using gcc, it would be amazing!

good luck, and remember to create your pr to the feat branch ⚠️

DOCS Split the README.md file in smaller files

The README.md file has grown as the project grew and improved, and I think it is time to divide it into smaller files, so this file could be divided into more, such as INSTALL.md, advanced.md etc etc. These files must go inside the doc folder

Remember to read the contributions guidelines before contributing!

Automate the client's makefile so that we don't have to modify it every time

The makefile of the client looks like:

TARGET = client
LIBS = -pthread
CC = gcc
CFLAGS = -g
FILES = # The files to be compiled

client: $(FILES)
	gcc -o $(TARGET) $(LIBS) $(FILES) $(CFLAGS)

The problem with this is that we have to change the FILES variable every time we have to add a new file, so it would be great if this could be automated in the makefile.
Remember that the trojan is in a different directory from the client itself and it also has to be compiled.

/trj
| ...
| /client
|| ...
||/trojan
||| ...
Read the contribution guidelines to resolve this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.