je voudrais savoir comment "vider" un Byte[]
enfaite j'ai un problème j'ai l'impression qu'il reste des donnés dans mon Byte[] je vous montre le code:
publicvoid ReceiveCallback(IAsyncResult ar)
{
int read = this.m_sock.EndReceive(ar);
NOTICE AUTH :*** Looking up your hostname...
NOTICE AUTH :*** Checking ident
NOTICE AUTH :*** Found your hostname
NOTICE AUTH :*** No identd (auth) response
:*** Found your hostname
ERROR :Closing Link: 127.0.0.1 (Connection Timed Out)
your hostname
donc il y a des choses (:*** Found your hostname et your hostname)
qui ne devrais pas être là si quelqu'un voit pourquoi...
je vous remercie d'avance
Salut,
Peut être que le programme qui t'envoie les données ne répond pas.
Tu peux simplifier la fonction ReceiveCallback comme ceci:
publicvoid ReceiveCallback(IAsyncResult ar)
{
if(m_sock.EndReceive(ar)>0)
msgsAera.Invoke(new DelegateDisplay(DisplayMessage), Encoding.ASCII.GetString(readbuf));
enfaite il suffisait de tenir compte de la longueur du buffer Encoding.ASCII.GetString(this.readbuf, 0, read)
voila ça fonctionne correctement maintenant