Computer Network Practical Programme 1
Computer Network Practical Programme 1
#include <stdio.h>
int main()
{
long nc = 0;
while (getchar() != EOF)
++nc;
printf("Total characters: %ld\n", nc);
#include <stdio.h>
#include <string.h>
int main() {
char input[500]; // Buffer to store input data
char stuffed_data[1000]; // Buffer for stuffed data
char framed_data[1000]; // Buffer for framed data
// Step 3: Frame the stuffed data with start and end delimiters
frame_data(stuffed_data, framed_data);
return 0;
}
write a program to implement the data link layer framing method bit stuffing.
#include <stdio.h>
#include <string.h>
// Function to frame the data with start and end flag sequences
void frame_data(char *stuffed_data, char *framed_data) {
// Add flag sequence at the start
strcpy(framed_data, FLAG_SEQUENCE);
int main() {
char input[500]; // Input data (string of bits)
char stuffed_data[1000]; // Stuffed data
char framed_data[1000]; // Framed data