answersLogoWhite

0

Write a Multi-user chat server and client?

Updated: 10/26/2022
User Avatar

Rajparimala

Lvl 1
14y ago

Best Answer

//Get and display distributed message

#include <sys/types.h> // for type

#include <sys/socket.h> // for socket API

#include <netinet/in.h> // for address

#include <arpa/inet.h> // for sockaddr_in

#include <stdio.h> // for printf()

#include <stdlib.h> // for atoi()

#include <string.h> // for strlen()

#include <unistd.h> // for close()

////////////////////////////////////////////

char *multiHostAddress = "239.255.10.10";

void getEcho (int sock)

{

struct sockaddr_in read_EP;

int stop = -1;

char *msg;

printf ("Waiting for message... \n");

while (stop < 0)

{

msg = (char *)recvfromDST (&read_EP, sock);

if (msg != NULL)

printf ("%s==>%s\n",inet_ntoa(read_EP.sin_addr),msg);

else

stop = 0;

}

}

////////////////////////////////////////////

int main(int argc, char **argv)

{

int sockMulti;

int readPort;

struct sockaddr_in EP_multi;

struct ip_mreq request;

unsigned char TTL=3;

//-------------

int MC_socket;

struct sockaddr_in server_EP, sender_EP;

char msg [60];

char *readmsg;

int port;

int stop = 0;

//--------------

//--------------

if (argc != 4)

{

IO_error(1,"Need host, send port and receive port.(e.g localhost 9000 9001)");

}

//--------------

else

{

//-----------------------------

//Send msg to server

port = atoi (argv[2]);

printf ("TCP Client to send message to Server %s at Port %d \n", argv[1], port);

setHostByName (&server_EP, argv[1], port);

MC_socket= sockTCP_create();

sock_connect(MC_socket, &server_EP);

while (stop 0);

}

//Receive msg from server

readPort = atoi (argv[3]);

printf ("Multicasting receiver at ports %d \n", readPort);

//Initialisation

sockMulti = sockUDP_create();

sockUDP_reuse (sockMulti);

setHostByAddr (&EP_multi, "any", readPort);

sock_bind (sockMulti, readPort);

sockUDP_join (sockMulti, multiHostAddress,&request);

//Use service

getEcho (sockMulti);

//Finalisation

sockUDP_drop (sockMulti, request);

close(sockMulti);

//----------------------------------

}

sock_shutdown(MC_socket, 1);

readmsg = NULL;

while (readmsg != NULL)

readmsg = (char *)readMessage(MC_socket);

//-----------------------------------

}

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a Multi-user chat server and client?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you get no class?

I know it is impossible but there is a thing to make you have no class. First buy a new class in a chat server then you have to open a new tab then login in a non-chat server in the first tab equip the class and in the second server sell the class. Then logout of both tabs and close the second tab login in the first tab and go in any server and there you have it no class if it does not work try loging out and go to the server you bought your class and you have it. If it still does not work try again or go ask again cause my way might not be fully detailed.&lt;(^_^)&gt; :):):):):):D:O:d


What is a daemon thread?

A daemon thread is often called a "service thread" or a "nonessential thread". The other kind of thread is often called a "user thread."The JVM will exit when all user threads have returned from their run methods. Once all of the user threads have returned, any active daemon threads will be forced to stop running.Let's look at an abstract example to see the difference... Pretend you have written a client-server GUI-based chat client. You'll typically have at least one thread sitting around and listening for input from the other program (the server will listen for input from the client and the client will listen for input from the server). These threads can be set as daemon threads, because you don't want the JVM to keep executing if those are the only threads left.Not let's look at the GUI for your programs. These will be run in a user thread, since you want to make sure that the JVM does not exit until the GUI thread finishes running (you will generally stop these threads from running when the user clicks to close the window).


What is the HTML to get a chatbox?

HTML is not a programming language, so you cannot create any applications with it. It is just for formatting the look and design of a page. To get a page to do something needs programming code. There is no HTML code that would create a chat room, so you would have to use a server scripting language like PHP or ASP.


What are advantages and disadvantages of lotus notes?

1. It's more secure then MS-exchange &amp; Outlook , because if have a Domino server then only you can access your Archive , and mails, calender, etc..... 2. Lotus Notes have a Same time messenger. That we can chat with internal users &amp; external users


Synopsis for project of chat server?

ABSTRACT This report details the work done towards the project "Chat Server". This particular project is a solution developed to communicate between the users across worldwide through Internet. The concept of sending letters and telegraphs has been reduced due to the new era of Internet Mailing. One such facility is being provided by the Chat Server. A message or an information can be sent via many medias, such as it can be telephonic, telegrams, fax etc to the reciepient. Each such information requires a high level of security. To maintain such security and smooth completion of any communication it requires more time and human effort in manual systems."Chat Server" automates all the aspects stated above related to a communication in a highly secure environment. This project has been developed to receive instant and urgent messages and to provide total user satisfaction.The entire process has been automated using JAVAtechnology and SQL SERVER to smoothen the flow of information in a highly secure environment across the network. The solution has been deployed, tested and validated thoroughly. While designing the system, care has been taken in efficiency, maintenance and reusability of the software for the present and future changes in the system.SYNOPSISThis is a copy of the synopsis, which was submitted to the institute in the beginning of the project.ABOUT THE PROJECT : -This particular project is a solution developed to communicate between the users across worldwide through Internet. The concept of sending letters and telegraphs has been reduced due to the new era of Internet Mailing. One such facility is being provided by the Chat Server."Chat Server" automates all the aspects stated above related to a communication in a highly secure environment. This project has been developed to receive instant messages and to provide total user satisfaction.Existing System: -It is limited to only two clients. The existing Chat Server System is only meant for transfer of messages from one client to the other. But the messages cannot be formatted and made attractive to look as well as graphical emotional pictures cannot be added to send the picture messages.This system does not provide the facility of sending and receiving greetings of different occasions. This system does not provide the facility of adding friends and exclusively chatting with the particular added friend.Proposed System: -PDS. [Predictivity Dialing System]. Eg. Avaia, Maclenn, SRC & so on. To enhance the performace the system, which helps them to monitor the performance of agents who r online.The proposed "Chat Server" is a chatting application that provides a good user interface with all the facilities of a chat application. Users have their user-id. User can communicate with any other user, who is online. User gets a list of online users. User can select any user and send a message.Message can be formatted in terms of font style and size. He can also send some graphical emotional pictures. This application also manages the list of all online users. It also provides the facility of browser window to surf simultaneous.Client Module:It provides a frame to login to the chat server. After providing the userid and password the get access to his main frame. He will get a list of online users, area to enter the text, options to format the message. He can also send some image with the message. This application provides option for changing his personal profile. The user can add any other user to his friend list.Server Module:The server module is responsible for validating the user information. It allows the authorized user to get facilities provided by this application. It also displays the online users list. It is connected to the database server to perform the function like modifying the user profile, creating a new user account etc.Advantages of Proposed System: -The application is feasible for the economic as well as the technical advantages it gives. The main advantages are: -As the solutions is integrated and developed on the JAVA technology so that it provides multi functionality services. The solution is built purely on the Java Technology using the latest version of Java Swing. So the solution is platform independent and architecture independent and supports different RDBMS packages as Java has in built support for the drivers of different databases. The JAVA based solution is defined as the solution for the enterprise wide application where each and every individual system are integrated on the JAVA platform for the smooth communication among different technologies and solutions.This particular project is a solution developed to communicate between the users across worldwide through Internet. The concept of sending letters and telegraphs has been reduced due to the new era of Internet Mailing. One such facility is being provided by the Chat Server. A message or an information can be sent via many medias, such as it can be telephonic, telegrams, fax etc to the reciepient. Each such information requires a high level of security. To maintain such security and smooth completion of any communication it requires more time and human effort in manual systems.This project has been developed to receive instant formatted test and graphical messages and to provide total user satisfaction.EXISTING CHATSERVER SYSTEM AND ITS LIMITATIONSExisting System: -It is limited to only two clients. The existing Chat Server System is only meant for transfer of messages from one client to the other. But the messages cannot be formatted and made attractive to look as well as graphical emotional pictures cannot be added to send the picture messages.This system does not provide the facility of sending and receiving greetings of different occasions. This system does not provide the facility of adding friends and exclusively chatting with the particular added friend.PROPOSED SYSTEMThe proposed "Chat Server" is a chatting application that provides a good user interface with all the facilities of a chat application. Users have their user-id. User can communicate with any other user, who is online. User gets a list of online users. User can select any user and send a message.Message can be formatted in terms of font style and size. He can also send some graphical emotional pictures. This application also manages the list of all online users. It also provides the facility of browser window to surf simultaneous.Client Module:It provides a frame to login to the chat server. After providing the userid and password the get access to his main frame. He will get a list of online users, area to enter the text, options to format the message. He can also send some image with the message. This application provides option for changing his personal profile. The user can add any other user to his friend list.Server Module:The server module is responsible for validating the user information. It allows the authorized user to get facilities provided by this application. It also displays the online users list. It is connected to the database server to perform the function like modifying the user profile, creating a new user account etc.HARDWARE REQUIREMENT SPECIFICATIONHardware Specification: -Server side:DescriptionMinimumRecommendedSystem typeIBM compatible PC with 1GHzIBM compatible PC with 2GHzRAM256 MB512 MBCache256 KB512 KBStorage40 GB120 GB(Convenient for Backup)Disk DriveFloppy or CD-RW(Back up purpose)Floppy or CD-RW or DAT(Back up purpose)Display15'' VGA17'' SVGA (LCD)User InterfaceKey Board and mouseCompatible keyboard and mouseOutput mediaDMP PrinterLaser Printer (For reports)Client Side:DescriptionMinimumRecommendedSystem typeIBM compatible PC with 1GHzIBM compatible PC with 1GHzRAM128 MB256 MBCache256 KB512 KBStorage20 GB40 GB(Convenient for Backup)Disk DriveFloppy or CD-RW(Back up purpose)Floppy or CD-RW(Back up purpose)Display (LCD)14'' VGA15'' SVGAUser InterfaceKey BoardCompatible keyboard and mouseOutput mediaDMP PrinterLaser Printer (For reports)

Related questions

What is best irc server for adult chat?

The best IRC server for Adult Chat is Collarspace. We offer a web-based chat client as well as access through your preferred IRC Client. Visit us on Collarspace or point your chat client to chat.collarspace.com on port 6667 and join us today!


What is an IRC client?

An IRC Client, or Internet Relay Chat Client, is a program used to connect to an Internet Relay Chat server so that a user can chat via text-based messages in real-time.


How do you get a chat bar if you have ultimate safe chat?

You can't if you are in a Server that is an ultimate Safe Chat Server. It has a Speech Bubble next to each server if it's Ultimate safe chat. If not, you can use the chat bar.


How do you chat on server?

chating in cysero server is like on other chat enabled server i hope that my answer is correct


How do you chat on cysero server?

chating in cysero server is like on other chat enabled server i hope that my answer is correct


How do you turn on chat on a Minecraft server?

On a Minecraft server, chat is always on. If one of your friends can't chat, then it is a problem on their end.


Can you write your own words in club penguin?

yes, unless when you made your penguin you went under ultimate safe chat, because then they write the words for you. Or if when your going into a server you click the server with a speech bubble.


How you can make multiuser in your chat?

It depends on which chat program you are using. In Skype, there is an + icon in the top right corner of each conversation. You would click that, then the add people option.


What is the best chat program?

I think that the best chat for local networks - MyChat. This is the new products on the market. Chat has a client-server structure. Small value distinguishes this product from other products. Chat can withstand more than 1000 users. Site - http://www.nsoft-s.com/en/aboutmychat.html


How can you get a club penguin chat bar?

Go onto a server without a chat bubble next to the server name.


Why doesn't my chat show in the chat box?

You chat might not show on Chat box. It could be due to an error that it can't connect to server. The internet connection could not connect to the server.


How do you get the chat bar on club penguin?

if you went on a server and it had a speech bubble (safe chat) the chat bar is not there.If you went on a server without the speech bubble the chat bar would be there.