Aller au contenu
View in the app

A better way to browse. Learn more.

Next

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pb d'envoie message dans un chat winsock serveur/c

Featured Replies

Posté(e)

Bonjour

Alors voila, mes profs nous ont donnés un petit chat a faire en VB avec winsock (alors qu'on a jamais fait de VB) et donc voici mon prob:

La connection se fait comme il faut, le client arrive a envoyé des messages au serveur mais le serveur n'arrive pas a envoyer de message au client. Pourtant lors de l'acceptation de la connection par le serveur, celui-ci arrive a envoyer le pseudo.

Lors de l'envoie du message l'erreur d'exectution 40006 s'affiche me disant que l'état de connection ou de protocole erroné pour la transaction ou la requete requise.

La ligne remise en cause est : SrvSock(0).SendData "SNDMSG " & "Serveur> " & Txt2Send.Text

Apparement le sock se remet en status 2 au lieu de rester sur 7.

Si quelqu'un pouvait me dire pourquoi ca bloque lors de l'envoie du message et non pas pendant l'envoie du pseudo.

Voici la source coté serveur :

Private Sub Command2_Click()

SrvSock(0).SendData "SNDMSG " & "Serveur> " & Txt2Send.Text Listdial.AddItem "Serveur> " & Txt2Send.Text

Txt2Send.Text = ""

End Sub

Private Sub Form_Load()

SrvSock(0).Close

SrvSock(0).LocalPort = "1337"

SrvSock(0).Listen

MsgBox "Serveur en écoute"

End Sub

Private Sub SrvSock_ConnectionRequest(Index As Integer, ByVal requestID As Long)

Index = Index + 1

Load SrvSock(Index)

SrvSock(Index).Accept requestID

SrvSock(Index).SendData "SNDNICK Serveur"

ListUsers.AddItem "Serveur"

End Sub

Private Sub SrvSock_DataArrival(Index As Integer, ByVal bytesTotal As Long)

SrvSock(Index).GetData recievedData, vbString

If Mid(recievedData, 1, 7) = "SNDNICK" Then

ListUsers.AddItem Mid(recievedData, 9, :zarb:

Exit Sub

End If

If Mid(recievedData, 1, 6) = "SNDMSG" Then

Listdial.AddItem Mid(recievedData, 8, 50)

End If

End Sub

Modifié par flexounet

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.