|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
Stabilire una connessione TCP con VB o VB.NET
Salve ragazzi . Il mio problema è il seguente :
Su di una macchina gira alla porta 28002 un servizio che si chiama DataServer che invia dati a seconda delle richieste che riceve su questa porta . Ora io ho su di un manuale il formato delle richieste ma il punto è un altro . Per connettermici usando il TCP ho usato con VB 6.0 l'oggetto Winsock . Quando vado a connettermi siccome il mio programma funge da client , mi dovrei aspettare qualche risposta dal Dataserver ? Quindi che faccio : all'evento Data_arrival memorizzo cioò che dovrebbe arrivarmi in una casella di teso ma non mi visualizza nulla . Cosa sbaglio ???? |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
Anzi ora vi posto le istruzioni del manuale Dataserver :
Every client program must implement the communication protocol summarized by the following steps : 1. Open a socket to the DataSever using the port number specified in the Dataserver configuration file (si tratta della porta 28002 da me configurata ) 2. Read the connection time from the socket as a 4-byte integer 3. Send a ConnectRequest to the DataServer 4. Wait for a Ready message from the DataServer I passi continuano ma mi fermo un secondo qui : Il formato della RequestConnection è il seguente : Header : 4 byte int Signature = 0x7ABCDE0F 4 byte int message type = 206 4 byte int message content length = 24 Content : 12 byte string User name 4 byte int Data Access Protocol Version 4 byte int The time in second that the connetion was opened 4 byte int 32-bit CRC computed for the username,password,connection time ..... Ora se il formato della richiesta è questo cosa invio con l'oggetto winsock ? |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Nov 2003
Città: ROMA
Messaggi: 1245
|
scusa ma nella funzione data_arrival per prendere il dato in arrivo hai creato una stringa che ne so di nome testo (inventata a caso) e poi hai fatto:
winsock.getdata testo ?
__________________
CPU: Ryzen 3900X - MB: Asus Crosshair VIII Hero - 4X8GB 32GB DDR4 3600mhz Corsair Vengeance RGB - VGA: Asus RTX 2080ti |
|
|
|
|
|
#4 | |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
Quote:
Si certo |
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 11:44.



















