LAN

Messaggioda TomSawyer » 17/05/2006, 15:55

Qualcuno conosce funzioni in C++ o VB6 per trasferire dati tra computer collegati in una LAN?
I watched a snail crawl along the edge of a straight razor. That's my dream. That's my nightmare. Crawling, slithering, along the edge of a straight... razor... and surviving., Walter E. Kurtz
Avatar utente
TomSawyer
Advanced Member
Advanced Member
 
Messaggio: 336 di 2270
Iscritto il: 16/11/2005, 16:18

Re: LAN

Messaggioda anonymous_be1147 » 19/05/2006, 14:28

Intendi qualche libreria in C++ per il networking?
anonymous_be1147
Cannot live without
Cannot live without
 
Messaggio: 59 di 3226
Iscritto il: 02/03/2006, 20:20

Messaggioda TomSawyer » 19/05/2006, 15:18

Precisamente qualche algoritmo che trasferisca file da un computer ad un altro. Anche qualche libreria mi può essere utile.
I watched a snail crawl along the edge of a straight razor. That's my dream. That's my nightmare. Crawling, slithering, along the edge of a straight... razor... and surviving., Walter E. Kurtz
Avatar utente
TomSawyer
Advanced Member
Advanced Member
 
Messaggio: 343 di 2270
Iscritto il: 16/11/2005, 16:18

Messaggioda TheWiz@rd » 19/05/2006, 17:19

Parlando di ambiente windows in C e VB c'è il winsock. In pratica implementarlo in VB è facilissimo e bastano davvero pochissime righe di codice per fare un programmino client-server. Mentre in C la situazione si complica poichè bisogna conoscere la teoria del SOCKET, la gestione è molto complicata anche se mille anzi mille^mille volte più efficiente del VB.:lol:

Questo è un client in C.

#include <stdio.h>
#include <winsock2.h>
#define PORT 5555

int winDLLstart();

void addr_initialize();

void addr_initialize(struct sockaddr_in *indirizzo, int port, long IPaddr){
indirizzo->sin_family = AF_INET;
indirizzo->sin_port = htons((u_short) port);
indirizzo->sin_addr.s_addr = IPaddr;
}


int main(int argc, char* argv[])
{
SOCKET sd;
struct sockaddr_in server_addr;
struct sockaddr_in mio_addr;
int mio_addr_len=sizeof(mio_addr);
int error;

addr_initialize(&server_addr, PORT, inet_addr(argv[1]));
if ( winDLLstart() != 0 ) return;
sd=socket(AF_INET,SOCK_STREAM,0);
error=connect(sd,(struct sockaddr*) &server_addr,sizeof(server_addr));
if (error==0){
printf("Ho eseguito la connessione\n");
getsockname(sd, &mio_addr, &mio_addr_len);*/
printf("il mio port e': %d\n\n",ntohs(mio_addr.sin_port) );
closesocket(sd);
}
else printf("%s","\nErrore di connect\n\n");
closesocket(sd);
return 0;
}
TheWiz@rd
TheWiz@rd
Junior Member
Junior Member
 
Messaggio: 126 di 172
Iscritto il: 27/01/2004, 18:11
Località: Italy

Messaggioda TomSawyer » 19/05/2006, 17:27

Grazie, quello che cercavo. Non sarebbe possibile fare questo in VB, senza dover avere il programma sul PC client?
I watched a snail crawl along the edge of a straight razor. That's my dream. That's my nightmare. Crawling, slithering, along the edge of a straight... razor... and surviving., Walter E. Kurtz
Avatar utente
TomSawyer
Advanced Member
Advanced Member
 
Messaggio: 349 di 2270
Iscritto il: 16/11/2005, 16:18

Messaggioda TheWiz@rd » 19/05/2006, 17:30

Crook ha scritto:Grazie, quello che cercavo. Non sarebbe possibile fare questo in VB, senza dover avere il programma sul PC client?


Temo di non aver capito. In che senso "senza dover avere il programma sul PC"? :?
TheWiz@rd
TheWiz@rd
Junior Member
Junior Member
 
Messaggio: 127 di 172
Iscritto il: 27/01/2004, 18:11
Località: Italy

Messaggioda TomSawyer » 19/05/2006, 17:50

Senza dover avere il programma che trasferisce i file su tutti e 2 i computer. Mi servirebbe poterlo fare solo da un computer (presumendo che ho accesso ad un solo PC). Ad esempio copiare un file su tutti i computer di una LAN, avendo il programma su un solo computer.
I watched a snail crawl along the edge of a straight razor. That's my dream. That's my nightmare. Crawling, slithering, along the edge of a straight... razor... and surviving., Walter E. Kurtz
Avatar utente
TomSawyer
Advanced Member
Advanced Member
 
Messaggio: 350 di 2270
Iscritto il: 16/11/2005, 16:18

Messaggioda TheWiz@rd » 19/05/2006, 21:11

uhm... secondo me ti sfugge il significato del concetto client-server. Allora se vuoi fare un programma che si connetta ad un computer per trasferirgli qualcosa, allora dovrai sfruttare un servizio attivo su qualche porta remota, quindi inevitabilmente dovrai avere una parte client che manda file e una parte server che li acquisisce e li tratta. :wink:
TheWiz@rd
TheWiz@rd
Junior Member
Junior Member
 
Messaggio: 128 di 172
Iscritto il: 27/01/2004, 18:11
Località: Italy

Messaggioda TomSawyer » 20/05/2006, 17:15

Ho capito. Volevo sapere proprio questo. Pensavo ci fosse un modo diverso. Grazie.
I watched a snail crawl along the edge of a straight razor. That's my dream. That's my nightmare. Crawling, slithering, along the edge of a straight... razor... and surviving., Walter E. Kurtz
Avatar utente
TomSawyer
Advanced Member
Advanced Member
 
Messaggio: 352 di 2270
Iscritto il: 16/11/2005, 16:18


Torna a Informatica

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite

cron