Skip to content

Instantly share code, notes, and snippets.

View AjayKrP's full-sized avatar

Ajay Kumar AjayKrP

View GitHub Profile
/*
* Data structure for packet in our GBN implementation
* Type indicates what kind of packet it is
* 0 - request
* 1 - ACK
* 2 - data
* 3 - teardown
* If type == data, then seq_no denotes the current packet's sequence number
* Length is the length of the data field
* Data carries the request or actual data; empty if type == ACK
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
import java.lang.String;
public class subnet_mask{
/*Function to separate the IP entered into 4 different octets*/
public int[] get_ip_octets(String string) {
int length = string.length();
/*This array has 4 rows, one for each octet of the IP address,
and 3 columns, one for each digit of the octet.*/
int oct[][] = new int[4][3];
for(int j = 0; j < 4; ++j) {
for (int q = 0; q < 3; ++q) {
#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <zconf.h>
#include <memory.h>
#include <stdbool.h>
#include <ctype.h>
void error(const char* msg){
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <netinet/in.h>
#include <netdb.h>
#include <memory.h>
#include <zconf.h>
void error(const char* msg){
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
void error(const char *msg) {
perror(msg);
@AjayKrP
AjayKrP / server.c
Created September 23, 2017 04:39
COMPUTER_NETWORK
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
void error(const char *msg) {
perror(msg);
#include <math.h>
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
typedef float Matrix4x4 [4][4];
Matrix4x4 theMatrix;
float ptsIni[8][3]={{80,80,-100},{180,80,-100},{180,180,-100},{80,180,-100},
{60,60,0},{160,60,0},{160,160,0},{60,160,0}};
#include <cmath>
#include <iostream>
#include <GL/glut.h>
using namespace std;
GLint n; //2n is number of petals on the rose
void init(){
glClearColor (1.0, 1.0, 1.0, 1.0); //set the background color to white
glColor3f (0.0, 0.0, 0.0); //set the foreground color to black
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
%include "Assembly/Exam/macro.asm"; use your own macro
;create two file with name file1.txt and file2.txt
;first you have to enter your choice i.e. 1 or 2 or 3....
;then enter commands
;give first file name as file1.txt and second file name as file2.txt
section .data
cmd db 0xa, "command menu"
db 0xa,"1.TYPE"
db 0xa,"2.COPY"