Code Monkey home page Code Monkey logo

cs321_lab03's Introduction

  • 👋 Hi, I’m ✨@je-el//Jewel Maldonado✨
  • 📚 I'm currently a Computer Science/Computer & Electrical Engineering Double Major at UAF.
  • 👀 I’m interested in Web Dev & Design, Software Development, Data Science, & Embedded System Programming.
  • 🌱 Currently I am learning advanced systems and algorithms
  • 💞️ I’d love to connect and collaborate on anything hands-on including HTML, CSS, JavaScript, C, C++, and Python.
  • 💡 Have an idea and want to collaborate? Reach me via email: [email protected]

cs321_lab03's People

Contributors

je-el avatar lisajacklin avatar

Watchers

 avatar

cs321_lab03's Issues

`clientSocket` not declared

int read = recv(clientSocket,data,1024,0);

There is an issue with calling anything with clientSocket as clientSocket has not been declared in the scope or globally. Unless declared within main.
It seems that sock should be used here instead since its the variable holding the socket file descriptor.

See following errors inheriting this issue:

NewClient.c:66:19: error: use of undeclared identifier 'clientSocket'
                int read = recv(clientSocket,data,1024,0);
                               ^
NewClient.c:72:12: error: use of undeclared identifier 'clientSocket'
     send (clientSocket, input, 1024, 0);
          ^
NewClient.c:74:18: error: use of undeclared identifier 'clientSocket'
     read = recv(clientSocket,data,1024, 0);
                ^

valread = read(sock , buffer, 1024);

valread needs to be a pointer or function pointer to prevent this error on compilation

NewClient.c:87:23: error: called object type 'int' is not a function or function pointer
        valread = read(sock , buffer, 1024);
                  ~~~~^

the scanf function in the client function is reading only one word of input, to read a full line including whitespace, etc try using fgets instead.

read = recv(clientSocket,data,1024, 0);

read cannot be used here as a variable, this may be a mistake and needs to be renamed.

On Line 74 this read variable has no relation to read() function. It is simply used to store the return value of the recv() function which reads data from the socket.

so rather try using something like:

int socketRead = recv(clientSocket,data,1024,0);

Assignment Task 5

  1. The process should not end only after one pass of message between server and client as it is now. Server will only stop if one of the clients sends ‘BYE’ message

Assignment Task 3

  1. Currently the server is accepting a client message (request) and sending a response message to the same client. In your new version, the server should forward the accepted message from one client to the other client.

Assignment Task 1

  1. In the current version there is only one client. But you must create two different clients.

Assignment Task 4

  1. The server should work properly only when two clients are up and connecting to it. If there is only one client connecting to the server then, the server will send a message complaining “only one client is up”

Assignment Task 8

  1. You may need to send the client process pids to the server to establish the connection

Assignment Task 7

  1. For the sake of simplicity, assume that both your client and servers are on the same machine i.e. localhost (127.0.0.1)

Assignment Task 6

  1. The server process should be designed in such a way so that it cannot be aborted by hitting ctrl-c on that terminal

Assignment Task 2

  1. Currently the messages are hardcoded in the program. But your code must read the client messages from the user.

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.