Lab:
ORDER NEW COPY OF LOW LEVEL MESSAGING SYSTEM ASSIGNMENT & GET HIGH QUALITY SOLUTIONS FROM SUBJECT'S TUTORS!
Design and implement versions of send() and receive() that record up to K messages per process.
The low level messaging system in xinu has two important functions send and receive. One main issue with the low level messaging in xinu is there is only one message and if another message is sent to a process, this message will be ignored.
You are required to change the original send and receive functions to allow sending and receiving up to K messages.
Client Program:
#include<stdio.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netdb.h>
#include<string.h>
#include<stdlib.h>
#include <arpa/inet.h>
#include <unistd.h>
#define MAX 20
#define PORT 43454
#define SA struct sockaddr
void function(int sockfail)
{
char buffer[MAX];
int no;
for(;;)
{
bzero(buffer,sizeof(buffer));
printf("Enter your message: ");
no=0;
int len=0;
while((buffer[no++]=getchar())!='\n')
{
len++;
}
if(len>MAX)
{
printf("Sorry buffer size is full !!!! ");
break;
}
else
{
while((buffer[no++]=getchar())!='\n');
write(sockfail,buffer,sizeof(buffer));
bzero(buffer,sizeof(buffer));
read(sockfail,buffer,sizeof(buffer));
printf("From Server : %s",buffer);
if((strncmp(buffer,"exit",4))==0)
{
printf("Client Exit...\n");
break;
}
}
}
}
int main()
{
int sockfd,connfd;
struct sockaddr_in servaddr,cli;
sockfd=socket(AF_INET,SOCK_STREAM,0);
if(sockfd==-1)
{
printf("Failed to create socket...\n");
exit(0);
}
else
printf("Created ..\n");
bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=inet_addr("127.0.0.1");
servaddr.sin_port=htons(PORT);
if(connect(sockfd,(SA *)&servaddr,sizeof(servaddr))!=0)
{
printf("Server Connection failed...\n");
exit(0);
}
else
printf("Server Connected..\n");
function(sockfd);
close(sockfd);
}
ARE YOU LOOKING FOR RELIABLE LOW LEVEL MESSAGING SYSTEM ASSIGNMENT HELP SERVICES? EXPERTSMINDS.COM IS RIGHT CHOICE AS YOUR STUDY PARTNER!
Server Program:
#include<stdio.h>
#include<netinet/in.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netdb.h>
#include<stdlib.h>
#include<string.h>
#include <unistd.h>
#define MAX 20
#define PORT 43454
#define SA struct sockaddr
void func(int sockfd)
{
char buffer[MAX];
int no;
for(;;)
{
bzero(buffer,MAX);
read(sockfd,buffer,sizeof(buffer));
printf("From client: %s\t To client : ",buffer);
bzero(buffer,MAX);
no=0;
int len;
while((buffer[no++]=getchar())!='\n');
write(sockfd,buffer,sizeof(buffer));
if(strncmp("exit",buffer,4)==0)
{
printf("Server Exit...\n");
break;
}
}
}
int main()
{
int sockfd,connfd,len;
struct sockaddr_in servaddr,cli;
sockfd=socket(AF_INET,SOCK_STREAM,0);
if(sockfd==-1)
{
printf("socket creation failed...\n");
exit(0);
}
else
printf("Socket successfully created..\n");
bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(PORT);
if((bind(sockfd,(SA*)&servaddr, sizeof(servaddr)))!=0)
{
printf("socket bind failed...\n");
exit(0);
}
else
printf("Socket successfully binded..\n");
if((listen(sockfd,5))!=0)
{
printf("Listen failed...\n");
exit(0);
}
else
printf("Server listening..\n");
len=sizeof(cli);
connfd=accept(sockfd,(SA *)&cli,&len);
if(connfd<0)
{
printf("server acccept failed...\n");
exit(0);
}
else
printf("server acccept the client...\n");
func(connfd);
close(sockfd);
}
ENROL WITH LOW LEVEL MESSAGING SYSTEM ASSIGNMENT HELP AND HOMEWORK WRITING SERVICES OF EXPERTSMINDS.COM AND GET BETTER RESULTS IN LOW LEVEL MESSAGING SYSTEM ASSIGNMENTS!