Ok, So I can successfully send and receive messages with my code, but the problem at hand is a little harder.
First the admin must start the server program and then read the current weather information for various cities from a data file and stores the information into an array of records. The user executes the client program and provides a city name to the program. The client sends that to the server, the server receives the information and obtains the current weather information for the city and sends the information back to the client. The sender code is 100% complete, and I have the base for the Receiver. Please help:
I have everything fixed in both codes, except for one part. Our professor didn't explain how to send the information back to the client...
So basically, I can compile both and run them. First I run the Server or Receiver code. It will say "Waiting for message on port 3145...". I then open my Client or Sender code and compile and run it. It says "Usage: ./a.out <address> <city>". I then type in "./a.out 127.0.0.1 "New York". After I send it, the Server is supposed to read the weather information for New York from an array of records (I.e Struct). Which I have created already, I just don't know how to properly execute the function to send back the information to the Client!!
2. Please use the code format tag from the pallet on the right to format your code.
3. You should think of your program as you've described it, a client/server app. Don't use the term sender/receiver. The server will listen for requests and serve them. The client make requests and receives answers.
4. The first thing to focus on is the weather data structures. Have you looked at all at how you might do this? As the server will be asked to look up by city, you must provide a function that looks up the data by city and returns something.
I can see the server use a variable info, but I can't see its definition.
5. There are issues with the comms, but let's get the basics right first.