Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Community > Tech > [C] winsok e MinGw
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
cato
Wild boys always shine

User info:
Registered: Nov 2001
Posts: 5608 (0.63 al dì)
Location: lecco
Corso: F28
Anno: dottore
Time Online: 38 Days, 5:42:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
[C] winsok e MinGw

sto usando dev-c++ che si basa su MinGW per qualche programma con le socket.
ma quando compilo il linker fallisce...

sapete se c'e' qualche parametro da settare?grazie,

__________________

code:
  , ,  | | Me@Flickr  [ov0] | | my photo Blog  {| |} |@| Pallavolo La Nuova Rossa Milano --"-"--| | -------| | "If You Can't Open It, You Don't Own It"

07-03-2005 16:03
Click Here to See the Profile for cato Click Here to See the Blog of cato Click here to Send cato a Private Message Visit cato's homepage! Find more posts by cato Add cato to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
DeepBlue
tired guy

User info:
Registered: Sep 2003
Posts: 4258 (0.52 al dì)
Location: CSN
Corso: Info tlc
Anno:
Time Online: 52 Days, 8:40:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

con che messaggio fallisce?

stai compilando programmi che utilizzano socket sotto win? Se sì, ricordati che gli header di rete probabilmente cambiano: devi usare winsock.h e winsock2.h

__________________
~ get Debian! ~ get FreeBSD! ~ get OpenBSD! ~

07-03-2005 16:12
Click Here to See the Profile for DeepBlue Click Here to See the Blog of DeepBlue Click here to Send DeepBlue a Private Message Find more posts by DeepBlue Add DeepBlue to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
cato
Wild boys always shine

User info:
Registered: Nov 2001
Posts: 5608 (0.63 al dì)
Location: lecco
Corso: F28
Anno: dottore
Time Online: 38 Days, 5:42:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

[Linker error] undefined reference to `socket@12' ad esempio

__________________

code:
  , ,  | | Me@Flickr  [ov0] | | my photo Blog  {| |} |@| Pallavolo La Nuova Rossa Milano --"-"--| | -------| | "If You Can't Open It, You Don't Own It"

07-03-2005 17:06
Click Here to See the Profile for cato Click Here to See the Blog of cato Click here to Send cato a Private Message Visit cato's homepage! Find more posts by cato Add cato to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
cato
Wild boys always shine

User info:
Registered: Nov 2001
Posts: 5608 (0.63 al dì)
Location: lecco
Corso: F28
Anno: dottore
Time Online: 38 Days, 5:42:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

prendendo un esempio dal comer

ftp://ftp.cs.purdue.edu/pub/comer/
http://www.cs.purdue.edu/homes/dec/netbooks.html


code:
/* TCPecho.cpp - main, TCPecho */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <winsock.h> void TCPecho(const char *, const char *); void errexit(const char *, ...); SOCKET connectTCP(const char *, const char *); #define LINELEN 128 #define WSVERS MAKEWORD(2, 0) /*------------------------------------------------------------------------ * main - TCP client for ECHO service *------------------------------------------------------------------------ */ int main(int argc, char *argv[]) { char *host = "localhost"; /* host to use if none supplied */ char *service = "echo"; /* default service name */ WSADATA wsadata; switch (argc) { case 1: host = "localhost"; break; case 3: service = argv[2]; /* FALL THROUGH */ case 2: host = argv[1]; break; default: fprintf(stderr, "usage: TCPecho [host [port]]\n"); exit(1); } if (WSAStartup(WSVERS, &wsadata) != 0) errexit("WSAStartup failed\n"); TCPecho(host, service); WSACleanup(); exit(0); } /*------------------------------------------------------------------------ * TCPecho - send input to ECHO service on specified host and print reply *------------------------------------------------------------------------ */ void TCPecho(const char *host, const char *service) { char buf[LINELEN+1]; /* buffer for one line of text */ SOCKET s; /* socket descriptor */ int cc, outchars, inchars; /* characters counts */ s = connectTCP(host, service); while (fgets(buf, sizeof(buf), stdin)) { buf[LINELEN] = '\0'; /* ensure line null-termination */ outchars = strlen(buf); (void) send(s, buf, outchars, 0); /* read it back */ for (inchars = 0; inchars < outchars; inchars += cc) { cc = recv(s, &buf[inchars], outchars-inchars, 0); if (cc == SOCKET_ERROR) errexit("socket recv failed: %d\n", GetLastError()); } fputs(buf, stdout); } closesocket(s); }


non compila...mi da errori con il linker...
che parametri vanno dati al compilatore?

__________________

code:
  , ,  | | Me@Flickr  [ov0] | | my photo Blog  {| |} |@| Pallavolo La Nuova Rossa Milano --"-"--| | -------| | "If You Can't Open It, You Don't Own It"

Last edited by cato on 07-03-2005 at 17:21

07-03-2005 17:19
Click Here to See the Profile for cato Click Here to See the Blog of cato Click here to Send cato a Private Message Visit cato's homepage! Find more posts by cato Add cato to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
DeepBlue
tired guy

User info:
Registered: Sep 2003
Posts: 4258 (0.52 al dì)
Location: CSN
Corso: Info tlc
Anno:
Time Online: 52 Days, 8:40:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Sinceramente non so aiutarti.

Prova a guardare qui http://groups-beta.google.com/group...0%60socket%4012'&hl=en&lr=&safe=off&sa=N&tab=wg

__________________
~ get Debian! ~ get FreeBSD! ~ get OpenBSD! ~

07-03-2005 19:29
Click Here to See the Profile for DeepBlue Click Here to See the Blog of DeepBlue Click here to Send DeepBlue a Private Message Find more posts by DeepBlue Add DeepBlue to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
yeah
.grande:maestro.

User info:
Registered: Nov 2003
Posts: 1644 (0.20 al dì)
Location: Cologno Monzese
Corso: Informatica Magistrale
Anno: II
Time Online: 12 Days, 21:36:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Hai incluso la libreria delle socket in Dev-cpp? Io uso solo mingw, senza IDE, quindi non so come si setta :/

se usi winsock.h devi linkare con wsock32
se invece usi winsock2.h devi linkare con ws2_32

__________________
?

07-03-2005 20:30
Click Here to See the Profile for yeah Click here to Send yeah a Private Message Find more posts by yeah Add yeah to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
fabpicca
jesus robot d'acciaio

User info:
Registered: May 2002
Posts: 2166 (0.25 al dì)
Location: Pieve Emanuele
Corso: Ticom
Anno:
Time Online: 12 Days, 23:12:28 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

io mi ricordo che per un problema di questo tipo il progetto di reti in C l'ho fatto sotto linux...

__________________
my website?|ubuntu linux|get Firefox|grazie Polonia |bagdad sour

"Come va che non ha le corna e le zampe di Caprone?" gli opposi. "Oh, Giuvà", mi disse il prete "adesso non si usa più.Satana è furbo". (I.Silone, Fontamara)
"Al giorno d'oggi non bisogna essere intelligenti, perchè la gente si offende" (un ubriacone)
"close your eyes / pay the price / for your paradise" (DM) "whatever you want to change/you'd better start changing it in your mind" (Transatlantic)

08-03-2005 11:04
Click Here to See the Profile for fabpicca Click Here to See the Blog of fabpicca Click here to Send fabpicca a Private Message Visit fabpicca's homepage! Find more posts by fabpicca Add fabpicca to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
cato
Wild boys always shine

User info:
Registered: Nov 2001
Posts: 5608 (0.63 al dì)
Location: lecco
Corso: F28
Anno: dottore
Time Online: 38 Days, 5:42:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by yeah
H
se usi winsock.h devi linkare con wsock32


:approved:

__________________

code:
  , ,  | | Me@Flickr  [ov0] | | my photo Blog  {| |} |@| Pallavolo La Nuova Rossa Milano --"-"--| | -------| | "If You Can't Open It, You Don't Own It"

08-03-2005 12:07
Click Here to See the Profile for cato Click Here to See the Blog of cato Click here to Send cato a Private Message Visit cato's homepage! Find more posts by cato Add cato to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
cato
Wild boys always shine

User info:
Registered: Nov 2001
Posts: 5608 (0.63 al dì)
Location: lecco
Corso: F28
Anno: dottore
Time Online: 38 Days, 5:42:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

mhh uso queste opzioni:

-lwsock32 -ladvapi32

e mi da questi errori:

[Linker error] undefined reference to `recv'
[Linker error] undefined reference to `send'
[Linker error] undefined reference to `bzero'
[Linker error] undefined reference to `bcopy'
M:\Vxx\vte\_ferrario\0307_onwork\wsocket\Makefile.win [Build Error] [Wsoket.exe] Error 1

:(

__________________

code:
  , ,  | | Me@Flickr  [ov0] | | my photo Blog  {| |} |@| Pallavolo La Nuova Rossa Milano --"-"--| | -------| | "If You Can't Open It, You Don't Own It"

14-03-2005 10:53
Click Here to See the Profile for cato Click Here to See the Blog of cato Click here to Send cato a Private Message Visit cato's homepage! Find more posts by cato Add cato to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
DeepBlue
tired guy

User info:
Registered: Sep 2003
Posts: 4258 (0.52 al dì)
Location: CSN
Corso: Info tlc
Anno:
Time Online: 52 Days, 8:40:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

per bzero e bcopy hai incluso memory.h?

__________________
~ get Debian! ~ get FreeBSD! ~ get OpenBSD! ~

14-03-2005 13:20
Click Here to See the Profile for DeepBlue Click Here to See the Blog of DeepBlue Click here to Send DeepBlue a Private Message Find more posts by DeepBlue Add DeepBlue to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
yeah
.grande:maestro.

User info:
Registered: Nov 2003
Posts: 1644 (0.20 al dì)
Location: Cologno Monzese
Corso: Informatica Magistrale
Anno: II
Time Online: 12 Days, 21:36:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Dal tuo post precedente sembrava che wsock32 risolvesse il problema.

Gli errori sono arrivati dopo aver aggiunto qualcosa? Puoi postare il codice?

Eventualmente prova a scambiare wsock32 e advapi32:
-ladvapi32 -lwsock32

Off-Topic:

Carino memory.h incluso in Mingw
code:
/* * This file is part of the Mingw32 package. * * memory.h maps to the standard string.h header. */ #ifndef __STRICT_ANSI__ #include <string.h> #endif


Non me lo immaginavo :)


Non sono sicuro, ma bzero() e bcopy() non esistono solo in Unix/Linux?

Forse no :)

__________________
?

Last edited by yeah on 14-03-2005 at 20:50

14-03-2005 20:46
Click Here to See the Profile for yeah Click here to Send yeah a Private Message Find more posts by yeah Add yeah to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 17:08.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.089 seconds (55.57% PHP - 44.43% MySQL) con 22 query.