Soporte de sockets !!!

Soporte de sockets !!!

Postby Antonio Linares » Sun Oct 30, 2005 9:06 am

Hemos completado la implementación de sockets y ahora ya están funcionando:

Image

Ya hay un nuevo FWPPC build listo para ser descargado. Sólo falta revisar el método SendFile() que aún no va bien. Sin embargo el método SendData() funciona correctamente.

En la imagen se ve como hemos establecido una comunicación por sockets desde el emulador de Pocket PC y el ejemplo sockserv.prg de FWH (FiveWin para Harbour en PC).
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JmGarcia » Wed Feb 21, 2007 8:44 am

Como no encuentro un sitio donde presentarme... lo hago aqui.
Me dedico a estas cosas de la navegación aérea y desarrollo herramientas para pruebas de sistemas.
Llevo bastantes años disfrutando de CLIPPER, FW, FWH, etc...

Y al ver este tema de sockets me pregunto:
Que tal las comunicaciones MULTICAST.

En FW ya las tengo dominadas, pero el FWPPC como sería...

P.D. Saludos para Rene, Niko, Luis y conocidos.
Mi abuelo decía: Los aviones vuelan porque Dios quiere, y los helicópteros ni Dios sabe porque vuelan.
FWH 16.02, xHarbour 1.2.3, Harbour 3.2.0, WorkShop 4.5, AJ Make 0.30, Borlan BCC 7.00, VisualStudio 2013
User avatar
JmGarcia
 
Posts: 654
Joined: Mon May 29, 2006 3:14 pm
Location: Madrid - ESPAÑA

Postby Antonio Linares » Wed Feb 21, 2007 9:17 am

JM,

El soporte de sockets de Windows Mobile en principio es compatible con el de Windows PC, por lo que podrías hacerlo como lo haces en el PC
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JmGarcia » Thu Apr 05, 2007 7:00 pm

Antonio Linares wrote:...por lo que podrías hacerlo como lo haces en el PC

En el PC lo hago todo WRAPEANDO las funciones...
Y ademas uso ESTRUCTURAS de datos.
¿ Seguro que esto mismo me funcionará ?

Ejemplos de codigos de estructuras:
STRUCT sockaddr
MEMBER s_family AS _INT
MEMBER s_port AS _INT
MEMBER s_addr AS LONG
MEMBER s_zero AS STRING LEN 8
ENDSTRUCT
STRUCT WSAData
MEMBER wVersion AS _INT
MEMBER wHighVer AS _INT
MEMBER szDescrip AS STRING LEN WSADESCRIPTION_LEN
MEMBER szSystem AS STRING LEN WSASYS_STATUS_LEN
MEMBER iMaxSock AS _INT
MEMBER iMaxUdpDg AS _INT
MEMBER lpVendor AS LONG
ENDSTRUCT
STRUCT ip_mreq
MEMBER i_multia AS LONG
MEMBER i_interf AS LONG
ENDSTRUCT
STRUCT Startup
MEMBER wVersion AS _INT
MEMBER wHighVer AS _INT
MEMBER szDescrip AS STRING LEN WSADESCRIPTION_LEN
MEMBER szSystem AS STRING LEN WSASYS_STATUS_LEN
MEMBER iMaxSock AS _INT
MEMBER iMaxUdpDg AS _INT
MEMBER lpVendor AS LONG
ENDSTRUCT

Ejemplos del wrapeo:
DLL32 FUNCTION WSAStartup(n AS LONG, pStruct AS LPSTR) AS LONG PASCAL FROM "WSAStartup" LIB "wsock32.dll"
DLL32 FUNCTION WSACleanup() AS LONG PASCAL FROM "WSACleanup" LIB "wsock32.dll"
DLL32 FUNCTION closesocket(af AS LONG) AS _INT PASCAL FROM "closesocket" LIB "wsock32.dll"
DLL32 FUNCTION MemCopy(dest AS LPSTR, src AS LPSTR, cb AS LONG ) AS VOID PASCAL FROM "RtlMoveMemory" LIB "Kernel32.dll"
DLL32 FUNCTION socket(af AS LONG, s_type AS LONG, protocol AS LONG ) AS LONG PASCAL FROM "socket" LIB "wsock32.dll"
DLL32 FUNCTION setsockopt(s AS LONG,level AS LONG,optname AS LONG,optval AS LPSTR,optlen AS LONG) AS LONG PASCAL FROM "setsockopt" LIB "wsock32.dll"
DLL32 FUNCTION getsockopt(s AS LONG,level AS LONG,optname AS LONG,optval AS LPSTR,optlen AS LONG) AS LONG PASCAL FROM "getsockopt" LIB "wsock32.dll"
DLL32 FUNCTION htonl(hostlong AS LONG) AS LONG PASCAL FROM "htonl" LIB "wsock32.dll"
DLL32 FUNCTION htons(hostshort AS LONG) AS _INT PASCAL FROM "htons" LIB "wsock32.dll"
DLL32 FUNCTION bind(s AS LONG, pStruct AS LPSTR,namelen AS LONG) AS LONG PASCAL FROM "bind" LIB "wsock32.dll"
DLL32 FUNCTION inet_addr(cp AS STRING) AS LONG PASCAL FROM "inet_addr" LIB "wsock32.dll"
DLL32 FUNCTION WSAAsyncSelect(s AS LONG, hWnd AS LONG, wMsg AS LONG, lEvent AS LONG) AS LONG PASCAL FROM "WSAAsyncSelect" LIB "wsock32.dll"
DLL32 FUNCTION recv(s AS LONG, Buf AS LPSTR, buflen AS LONG, flags AS LONG) AS LONG PASCAL FROM "recv" LIB "wsock32.dll"
DLL32 FUNCTION recvfrom(s AS LONG, Buf AS LPSTR, buflen AS LONG, flags AS LONG, addr As sockaddr, i AS LONG) AS LONG PASCAL FROM "recvfrom" LIB "wsock32.dll"
DLL32 FUNCTION send(s AS LONG, Buf AS LPSTR, buflen AS LONG, flags AS LONG) AS LONG PASCAL FROM "send" LIB "wsock32.dll"
DLL32 FUNCTION sendto(s AS LONG, Buf AS LPSTR, buflen AS LONG, flags AS LONG, addr AS LPSTR, i AS LONG) AS LONG PASCAL FROM "sendto" LIB "wsock32.dll"

Ejemplos de código:
sockaddr:s_family:=AF_INET
sockaddr:s_addr :=inet_addr(m_HostSet)
sockaddr:s_port :=htons(m_PortSet)
sockaddr:s_zero :=replicate(chr(0), 8 )
cTemp:=sockaddr:cBuffer
rc:=bind(SocketNum,@cTemp,sockaddr_size)
sockaddr:cBuffer:=cTemp
if rc<>0
MsgAlert("Fallo en BIND")
SocketNum:=-1
return nil
endif
stMreq2:i_interf:=inet_addr(m_HostSet)
cTemp:=stMreq2:cBuffer
rc:=setsockopt(SocketNum,IPPROTO_IP,IP_MULTICAST_IF,@cTemp,stMreq2:SizeOf())
stMreq2:cBuffer:=cTemp
if rc<>0
MsgAlert("Fallo en SETSOCKOPT-IF")
SocketNum:=-1
return nil
endif
Mi abuelo decía: Los aviones vuelan porque Dios quiere, y los helicópteros ni Dios sabe porque vuelan.
FWH 16.02, xHarbour 1.2.3, Harbour 3.2.0, WorkShop 4.5, AJ Make 0.30, Borlan BCC 7.00, VisualStudio 2013
User avatar
JmGarcia
 
Posts: 654
Joined: Mon May 29, 2006 3:14 pm
Location: Madrid - ESPAÑA

Postby Antonio Linares » Fri Apr 06, 2007 9:54 am

Debería funcionar, pruébalo :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Pocket PC

Who is online

Users browsing this forum: No registered users and 28 guests