Skip to main content

Posts

Basic Priority queue in C

The source code of basic priority queue is given : #include<stdio.h> #include<malloc.h> void insert(); void del(); void display(); struct node     {         int priority;         int info;         struct node *next;     }*start, *q, *temp, *new; typedef struct node *N; int main() {     int ch;     do      {             printf( "\n[1] INSERTION\t[2] DELETION\t[3] DISPLAY [4] EXIT\t:" );             scanf( "%d", &ch );             switch ( ch )                 {               ...

Hadoop Simple Indexer source code with Map reduce

/*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package lineindexer; /**  *  * @author masteruser  */ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.filecache.DistributedCache; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.FileInputFormat; import org.apache.hadoop.mapred.FileOutputFormat; import org.apache.hadoop.mapred.FileSplit; import org.apache.hadoop.mapred.JobClient; import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.Mapper; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reducer; import org.apache.had...

SCTP server client Code in C

Client.c #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <netinet/sctp.h> #include <arpa/inet.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <errno.h> #define RECVBUFSIZE     4096 #define PPID            1234 int main() {        int SctpScocket, in, flags;        socklen_t opt_len;        char * szAddress;        int iPort;        char * szMsg;        int iMsgSize;        char a[1024];            struct sockaddr_in servaddr = {0};        struct sctp_status status = {0};    ...

Multithreading in C in Different CPU core

# define _GNU_SOURCE # include <stdio.h> # include <math.h> # include <stdlib.h> # include <pthread.h> # include <stdlib.h> pthread_mutex_t mux = PTHREAD_MUTEX_INITIALIZER; struct p2p{ int st; int en; }; void *primeChk(void* val); int main() {   pthread_t thread1,thread2,thread3,thread4;   struct p2p valu1,valu2,valu3,valu4;   int j,ret1,ret2,ret3,ret4;   cpu_set_t cpuset; // pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);   valu1.st = 1;   valu1.en = 5000;   valu2.st = 5001;   valu2.en = 10000;   valu3.st = 10001;   valu3.en = 15000;   valu4.st = 15001;   valu4.en = 20000;    // initialization    CPU_ZERO(&cpuset);    CPU_SET(0,&cpuset);    pthread_setaffinity_np(thread1, sizeof(cpu_set_t), &cpuset);    ret1 = pthread_create(&thread1,NULL,&primeChk,(void*)&valu1);    //CPU_ZERO(&cpuse...

UDP server client in c

Server #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <stdlib.h> int main() {         int sock;         int addr_len, bytes_read;         char recv_data[1024],send_data[1024];         struct sockaddr_in server_addr , client_addr;         if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {             perror("Socket");             exit(1);         }         server_addr.sin_family = AF_INET;         server_addr.sin...

TCP server client in C

Client Code #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> int main() {         int sock, bytes_recieved;         char send_data[1024],recv_data[1024];         struct hostent *host;         struct sockaddr_in server_addr;         host = gethostbyname("127.0.0.1");         sock = socket(AF_INET, SOCK_STREAM,0);         server_addr.sin_family = AF_INET;         server_addr.sin_port = htons(5000);         server_addr.sin_addr = *((struct in_addr *)host->h_addr);   ...

Video Conferencing Source code in JAVA

My video conferencing project was completed as 300 project for 3rd year.It is not totally completed. There is some bug in here.To solve these bugs and to help other students this project is open.It is first try to make a project open source in this way so it can be modified.Any kind of question against this project will be answered. As this project was created in 3rd year 1st semester and now i nearly completed my BSc. so there will be little description about this.I will try to describe every class and function later when i get the chance. ####################################################### FEATURE  ####################################################### 1.Multi Chat(Used Threadpole) 2.P2P Chat 3.P2P Audio Chat 4.P2P Video Chat 5.Complete Automated 6.H.263 compression Video  7.raw audio PREREQUISITE:  1. JUST INSTALL jmf-2.1.1 e 2.SQL LINK OF THE SOURCE CODE