Remote Exploit Forums

Go Back   Remote Exploit Forums > Specialist Topics > Programming


Programming A place for our community to discuss their own security related coding projects.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-18-2009, 11:02 AM
Jase21's Avatar
Junior Member
 
Join Date: Oct 2007
Posts: 15
Question How to increase the message queue size in IPC

How to increase the message queue size in IPC in
the msgsnd() and msgrcv().

Code:
//file1.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/msg.h>

struct msgbuf {
	int msgtype;
	char msgtext[21];
}msg;

main()
{
	int mid;
	
	mid = msgget(012, IPC_CREAT);
	if(mid < 0) 
		printf("\nError");
	else {
		msg.msgtype = 1;
		printf("\nEnter the message: ");
		scanf("%s", msg.msgtext);
		msgsnd(mid, msg.msgtext, msg.msgtype, 0);
	}
}
Code:
//file2.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/msg.h>

struct msgbuf {
	int msgtype;
	char msgtext[21];
}msg;

main()
{
	int mid;
	
	mid = msgget(012, IPC_CREAT);
	if(mid < 0) 
		printf("\nError");
	else {	
		msgrcv(mid, msg.msgtext, sizeof(msg.msgtext), 0, 0);
		printf("\nRecieved message: %s", msg.msgtext);
	}
	msgctl(mid, IPC_RMID, NULL);
	printf("\n");
}
When i enter hello world
the complete string doesn't be recieved.
Please help.
Please reply at the earliest.
Thank You.
__________________
Believe to see

Last edited by Jase21; 10-18-2009 at 11:11 AM.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:57 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2