WOW !! MUCH LOVE ! SO WORLD PEACE !
Fond bitcoin pour l'amélioration du site: 1memzGeKS7CB3ECNkzSn2qHwxU6NZoJ8o
  Dogecoin (tips/pourboires): DCLoo9Dd4qECqpMLurdgGnaoqbftj16Nvp


Home | Publier un mémoire | Une page au hasard

 > 

"Mise en place d'une base de données pour la gestion des abonnés d'un fournisseur d'accès au réseau". Cas de Microcom/Kananga.

( Télécharger le fichier original )
par Jean MUAMBA
Université Notre Dame du Kasayi - Graduat en Informatique de la Gestion 2016
  

précédent sommaire suivant

Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy

Codes Sources de l'interface Serveur

using System;

using System.Net;

using System.Net.Sockets;

using System.Collections;

using System.Threading;

using System.IO;

namespace DefaultNamespace

{

public class Server:forwardToAll

{

ArrayList readList=new ArrayList(); //liste utilisée par Port.select

string msgString=null;

string msgDisconnected=null; //Notification connexion/déconnexion

byte[] msg;//Message sous forme de bytes pour

public bool useLogging=false;

public bool readLock=false;//Flag aidant à la synchronisation

private string rtfMsgEncStart="\pard\cf1\b0\f1 ";//Code RTF

private string rtfMsgContent="\cf2 ";//code RTF

private string rtfConnMsgStart="\pard\qc\b\f0\fs20 "; //Code RTF

public void Start()

{

//réception de l'adresse IP

IPHostEntry ipHostEntry = Dns.Resolve(Dns.GetHostName());

IPAddress ipAddress = ipHostEntry.AddressList[0];

Console.WriteLine("IP="+ipAddress.ToString());

Socket CurrentClient=null;

//Création du port

Port ServerPort = new Port(AddressFamily.InterNetwork,

SocketType.Stream,

ProtocolType.Tcp);

try

{

//On lie la socket au point de communication

ServerSocket.Bind(new IPEndPoint(ipAddress, 1600));

//On la positionne en mode "écoute"

ServerSocket.Listen(10);

//Démarrage du thread avant la première connexion client

Thread getReadClients = new Thread(new ThreadStart(getRead));

getReadClients.Start();

Thread pingPongThread = new Thread(new ThreadStart(CheckIfStillConnected));

pingPongThread.Start();

while(true){

Console.WriteLine("Attente d'une nouvelle connexion...");

CurrentClient=ServerSocket.Accept();

Console.WriteLine("Nouveau client:"+CurrentClient.GetHashCode());

acceptList.Add(CurrentClient);

}

}

catch(SocketException E)

{

Console.WriteLine(E.Message);

}

}

private void Logging(string message)

{

using (StreamWriter sw = File.AppendText("chatServer.log"))

{

sw.WriteLine(DateTime.Now+": "+message);

}

}

//Méthode démarrant l'écriture du message

private void writeToAll()

précédent sommaire suivant






Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy








"En amour, en art, en politique, il faut nous arranger pour que notre légèreté pèse lourd dans la balance."   Sacha Guitry