Skip to content

Instantly share code, notes, and snippets.

@nopid
nopid / chatd.adb
Created October 5, 2015 16:19
Programmation Socket en Ada
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.Sockets; use GNAT.Sockets;
with GNAT.Sockets.Friendly; use GNAT.Sockets.Friendly;
procedure Chatd is
type idcli is range 1..100;
type user(Connected : Boolean := false) is record
case Connected is
when False => null;
when True =>
@nopid
nopid / chatd.c
Created October 4, 2015 17:38
Programmation Socket en C
#include <sys/types.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define BUFLEN 1024
@nopid
nopid / chatd.py
Last active December 28, 2015 07:59
Correction TP2 Programmation avec l'API socket
#!/usr/bin/python
##
# TCP chat server
# port 1664
##
from socket import *
from select import select
# create an TCP socket instance
s=socket(AF_INET, SOCK_STREAM)