Hi

I've got a problem using send() function (defined in afxsock.h) in a
VB6 compatible DLL that I've made.


Let me explain the situation :


I'm coding a Server-Client application.
- The server runs on a XPEmbedded Windows, and is programmed with
VC++6. Sockets declarations and recv() & send() function are defined in

afxsock.h.
- The client runs on a Windows XP Fammily edition and is programmed in
VB6. I had some problems in making the both communicate beacause of the

limited size of paquets that can be send with winsock SendData in VB.
More over I had already written the Client program in VC++6 using
afxsock, that worked very well.


So I had written a VB6 compatible DLL with VC++ that I've included in
my VB code.


The Dll launches well as I can display some MsgBox, but the characters
send to the server aren't received altough the code is hardly the same
to my VC++ client program.


Are there some cautions to use send() in a Dll ?


Here are some pieces of my codes:


/////////////////////////////////////////
///// Client Dll /////////////////////
/////////////////////////////////////////


#define TRANSF_DTF 20


void __stdcall Transfert_DTF(LPSTR string)
{


WSADATA initialisation_win32;
SOCKET socketID;
SOCKADDR_IN Sock_addr;
unsigned char buffer[PAQUETETH];
unsigned char buffer_ack[4];
HANDLE hFile;
char temp[30];
int packetnbr, packetnbr_ack;
int size;


MessageBox(NULL,"Enter the DLL","Message",MB_OK);


hFile =3D CreateFile( string, // open file
GENERIC_READ, // open for reading
FILE_SHARE_READ, // share for reading
NULL, // no security
OPEN_EXISTING, // existing file only
FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attr. template


if (hFile =3D=3D INVALID_HANDLE_VALUE)
{
MessageBox(NULL, "Error", "Message", MB_OK);
}


size =3D GetFileSize(hFile,NULL);
sprintf(temp, "size : %d", size);
MessageBox(NULL,temp,"Message",MB_OK);


//
********************************************************
// Winsock Initialization


erreur=3DWSAStartup(MAKEWORD(2,2),&initialisation_win32);


socketID=3Dsocket(AF_INET,SOCK_STREAM,0);


Sock_addr.sin_family=3DAF_INET;
Sock_addr.sin_addr.s_addr=3Dinet_addr("192.168.0.2");
Sock_addr.sin_port=3Dhtons(8686);


connect(socketID,(struct
sockaddr*)&Sock_addr,sizeof(Sock_addr));


buffer_ack[3] =3D TRANSF_DTF;


compt =3D send(socketID, (char*)buffer_ack, 4, 0);
sprintf(temp, "Send : %d", compt);
MessageBox(NULL,temp,"Message",MB_OK);


compt =3D recv(socketID,(char*)buffer_ack,4,0);
sprintf(temp, "Recv : %d", compt);
MessageBox(NULL,temp,"Message",MB_OK);


/////////////////////////////////////////////////////////////


//////////////////////////
///// Server///////////
//////////////////////////


// Same initialisations, then : //


transf_sock =3D accept(socketID,(struct
sockaddr*)&Socket_addr.sin_addr,NULL);
popup(hWnd, "accepted", 40, NOIR); // display function


if(transf_sock =3D=3D INVALID_SOCKET)
{
sprintf(temp,"error invalid transf_sock n=B0 %d",
WSAGetLastError());
popup(hWnd, temp, 10, NOIR);



}


recv(transf_sock,(char*)buffer_ack,4,NULL);
sprintf(temp, "interception : % d\n", (UCHAR)buffer_ack[3]);
popup(hWnd, temp, 70, NOIR);

/////////////////////////////////////////////////////////////


Both programs are blocked as the server don't receive the first 4
bytes...=20


Someone can help me ?=20


Thanks.=20


Matthieu.