Προς το περιεχόμενο

Visual Basic,Winsock


NickTheGreek

Προτεινόμενες αναρτήσεις

Δημοσ.

Exo ftiaksei ena mikro programmataki epikoinonias gia lan,meso winsock basizomenos sto UDP protocol,xoris api calls kai tetoia.<BR>Mporei na mou pei kaneis giati THN PROTH MONO fora pou tha epixeiriso na steilo minima se kapoion allon epixeirei na kanei sindesi sto internet anoigontas to dialup?<BR>Ean xrisimopoiiso ta api's tou winsock mporo na to parakampso?

Δημοσ.

Loipon gia osous endiaferontai to problima brisketai sto api gethostbyname to opoio otan kaleitai psaxnei prota sto internet gia thn sigkekrimeni dieuthinsi kei meta sto lan.Parakamptetai eukola,alla apaitei gnosi ton api's.O parakato kodikas anoigei mia socket kai stelnei (ipotithetai)dedomena s'auth sto sigkekrimeno port,eno tha eprepe na eidopoiouse otan ginotan egrafi sth socket kati omos pou den kanei.An kaneis kserei giati as mou pei.<P>rc = WSAStartup(&H101, StartupData)<BR>if rc < 0 then <BR> goto cleanup<BR> msgbox "error in wsastartup"<BR>end if<BR>Host = "169.254.0.1"<BR>socketbuffer.sin_family = AF_INET<BR>socketbuffer.sin_port = htons(179) 'port number<BR>socketbuffer.sin_addr = GetHostByNameAlias(Host)<P>Sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)<BR>If Sock = SOCKET_ERROR Then<BR> MsgBox "error in socket"<BR> Exit Sub<BR>End If<BR>rc = WSAAsyncSelect(Sock, Form1.hWnd, &H202, FD_READ)<P>'write to socket<BR>msgbuffer = Text3.Text<BR>rc = sendto(Sock, msgbuffer, Len(msgbuffer), 0 , socketbuffer, Len(socketbuffer))<BR>exit sub<BR>cleanup:<BR>closesocket(sock)<BR>rc=wsacleanup()<BR>end sub<p>[ 03-06-2001: Message edited by: NickTheGreek ]

Αρχειοθετημένο

Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.

  • Δημιουργία νέου...