C language basic to Advance
2K subscribers
16 photos
2 videos
69 links
Download Telegram
C language basic to Advance pinned «20 questions related to c loops https://t.me/C_Codes_pro/184 Answers 🔥 (can run also) https://t.me/C_Codes_pro/212 Your 10 to 30 numbers is final in c if you practice these 20 questions»
Now its discussion group is public
You can join it
@C_Group_pro
🥰1
Select your group/channel/service
t.me/Sid_info/69
🥰1
// udp server program
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>

#define PORT 8888
#define MAX_BUFFER_SIZE 1024

int main() {
    int sockfd;
    struct sockaddr_in serverAddr, clientAddr;
    socklen_t addrLen = sizeof(clientAddr);
    char buffer[MAX_BUFFER_SIZE];

    // Creating socket file descriptor
    if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
        perror("Socket creation error");
        exit(EXIT_FAILURE);
    }

    memset(&serverAddr, 0, sizeof(serverAddr));
    memset(&clientAddr, 0, sizeof(clientAddr));

    serverAddr.sin_family = AF_INET;
    serverAddr.sin_addr.s_addr = INADDR_ANY;
    serverAddr.sin_port = htons(PORT);

    // Bind the socket to the specified port
    if (bind(sockfd, (const struct sockaddr *)&serverAddr, sizeof(serverAddr)) == -1) {
        perror("Bind error");
        exit(EXIT_FAILURE);
    }

    printf("UDP server running on port %d\n", PORT);

    // Receive data from clients indefinitely
    while (1) {
        int bytesReceived = recvfrom(sockfd, (char *)buffer, MAX_BUFFER_SIZE, 0, (struct sockaddr *)&clientAddr, &addrLen);
        buffer[bytesReceived] = '\0'; // Null-terminate the received data
        printf("Received message from client: %s\n", buffer);
    }

    return 0;
}
👍2🤬21
// udp client program
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>

#define PORT 8888
#define SERVER_IP "127.0.0.1"

int main() {
    int sockfd;
    struct sockaddr_in serverAddr;
    char *message = "Hello, UDP Server!";

    // Creating socket file descriptor
    if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
        perror("Socket creation error");
        exit(EXIT_FAILURE);
    }

    memset(&serverAddr, 0, sizeof(serverAddr));

    serverAddr.sin_family = AF_INET;
    serverAddr.sin_port = htons(PORT);
    serverAddr.sin_addr.s_addr = inet_addr(SERVER_IP);

    // Send a message to the server
    if (sendto(sockfd, (const char *)message, strlen(message), 0, (const struct sockaddr *)&serverAddr, sizeof(serverAddr)) == -1) {
        perror("Sendto error");
        exit(EXIT_FAILURE);
    }

    printf("Message sent to server: %s\n", message);

    close(sockfd);

    return 0;
}

/*
If you want run udp server and client program here then use 2 telegram id

First run udp server program from 1st id
Then run udp client program from second id
Otherwise it will give error
*/
👍6
Everything related to coding 👇
https://t.me/addlist/2UhsQW_cGzkxMzg1
C language advance topics
@C_Codes_pro
Apna khud ka Compiler bot run karna ab bahut simple hai

Bas iocompiler lib install karo aur code run kardo 👇ye dekho poori details

https://t.me/logicBots/207
👍3
C language
https://youtu.be/GPat5ENZytg

C language samajhane ke liye har tarah ka prayas 👇

By defination
By real life example
By in deep memory how c works
By codes examples
By practical code run
👍4🥰21
👍21
If you want learn js for website development 👇join it
@react_next_js

For any problems in js site development feel free to ask questions 😊👇
@reactjs_nextjs_group
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  Free Study Resources everything join more https://t.me/addlist/c3QWwWR-Iw4xMDNl

Subscribe Our New channel for coding, designing, hacking and computer related everything 😁
👉 https://youtube.com/@CODEBOMBB
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
👍1
This media is not supported in your browser
VIEW IN TELEGRAM
👩‍💻 Welcome to @CodesSnippet! 🔫

Join us for daily snippets of coding👩‍💻 knowledge! 💻

Here, you'll find 👀 bite-sized pieces of code, programming tips, and tricks to level up your coding skills! 💻

Stay updated on the latest trends in the tech world and engage with fellow coders 💗 in our vibrant community! 🌐💬

Let's crack the coding 👩‍💻 together and bring your projects to life!
⭐️👨‍💻


Lang : Python , Java, Javascript, c++ and many more.
#CodeSnippet
#ProgrammingFun

Jᴏɪɴ ᴜs :- @CodesSnippet
👍21