I was hoping someone could assist me on a text-based instant messaging client(using UDP) I am working on. I have the network communication basics already in place but, specifically, needed some further help on the "messaging other users" and "getting a user list" functions. The server code that the client will communicate with is not available to me, but I will list the implementation details below. Any help would be greatly appreciated.
The client header fields include:
Type:
0x00-Login request
0x01-Login reply
0x02-Logout request
0x03-Logout reply 0x04-User list request 0x05-User list reply-Parameter indicates the number of users. Data contains list of users each separated by a comma.
0x06-Message-Includes recipient user name and message(there is no message reply or acknowledgement)
User Len: Length of the From User Name field
Param Len: Length of the Optional Parameter field
Data Length: Length of the Optional Data field
Sequence Number: Used to match requests and replies between client and server. In other words, a request's corresponding reply will have the same sequence number. The client should increment the sequence number (by one) with each new request.
From User Name: Client user name
Optional Parameter: Name of the message recipient, or number of user names in a user list
Optional Data: Arbitrary message data from the user, or list of user names
Implementation Details:
Here is an example sequence of events:
1. The client will prompt for a user name.
2. The client will issue a login request to the server, and receive a reply from the server.
3. Upon a successful login, the client will use the select() call and wait for input from:
a. User input (file descriptor 0)
i. Upon receiving user input, the client will determine if the user
wants to request a user list or send a message to a user.
ii. If the user asks for a user list, the client will send a user list request
packet to the server, and display the response.
iii. If the user wants to send a message, the client will prompt the user
for the recipient and message, and send a Message packet to the
server.
iv. The client will not receive confirmation that the message was
delivered.
b. Message for the user from the server (socket file descriptor)
i. If there is an incoming message from the server, the client will
display the user it's from along with the message.
4. If the user chooses to quit, a logout request is sent to the server, and the client exits.
5. Repeat steps 3-4
Here is the client code I have come up with so far. I have bolded the "user list" and "message user" areas.
With a little bit of work, was able to build a nice "Wuhan Coronavirus Status" app using MQTT and the IoT-OnOff app. More on this technique here:
ESP32 (ESP-WROOM-32) as an MQTT Client Subscribed to Linux Server Load Average Messages
The result turned out nice, I think. I like the look and... (10 Replies)
Hi,
Could you please tell me how to check instant client is installed in Linux server?
OS -- Linux 5.11
Oracle -- 10.2.0.5.0
Regards,
Maddy (2 Replies)