Click here to Skip to main content
15,886,774 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to display a image in an Activex webpage Pin
Richard MacCutchan24-Jan-11 10:27
mveRichard MacCutchan24-Jan-11 10:27 
GeneralRe: How to display a image in an Activex webpage Pin
yindoor24-Jan-11 16:42
yindoor24-Jan-11 16:42 
GeneralRe: How to display a image in an Activex webpage Pin
Richard MacCutchan24-Jan-11 21:17
mveRichard MacCutchan24-Jan-11 21:17 
QuestionTCP/IP client / serveur and Win7 Pin
shoppinit24-Jan-11 7:52
shoppinit24-Jan-11 7:52 
AnswerRe: TCP/IP client / serveur and Win7 Pin
TheGreatAndPowerfulOz24-Jan-11 8:22
TheGreatAndPowerfulOz24-Jan-11 8:22 
GeneralRe: TCP/IP client / serveur and Win7 Pin
shoppinit24-Jan-11 9:37
shoppinit24-Jan-11 9:37 
GeneralRe: TCP/IP client / serveur and Win7 Pin
TheGreatAndPowerfulOz25-Jan-11 13:31
TheGreatAndPowerfulOz25-Jan-11 13:31 
GeneralRe: TCP/IP client / serveur and Win7 Pin
shoppinit25-Jan-11 21:55
shoppinit25-Jan-11 21:55 
Thanks for your suggestion. The configuration seems to be OK. In any case, the port and IP is set correctly. Bizarrely currports show that the server is listening and that the connection is established on the client, but accept never unblocks.

I have now rewritten the client code using getaddrinfo() to request the socket and now it works. Inexplicably, it now works even though I am still connecting with the same socket and address.

I am curious to know why it works OK on XP but not Win7 in case I have future problems. I will post the server and client code snippets to see if you can see where the problem is.

Server:


err = WSAStartup( wVersionRequested, &wsaData );
sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_port		= htons(port);

sock = socket(AF_INET, SOCK_STREAM, 0); //Tried IPPROTO_TCP, too. 

qtest = bind(sock, (SOCKADDR *)&sin, sizeof(sin));

result = setsockopt(sock,  SOL_SOCKET,   SO_REUSEADDR,   (char *) &flag,  sizeof(int));  
...
test = listen(m_sock->get_sock(), 0);

m_sock->set_com_sock(accept(m_sock->get_sock(), (SOCKADDR *)&m_sock->get_sin(), &sinsize));



Client:


sin.sin_family	= AF_INET; 

WSAStartup(MAKEWORD(2,0), &WSAData);

sock = socket(AF_INET,SOCK_STREAM,0);

err = bind(sock, (SOCKADDR *)&sin, sizeof(sin));

err = connect(sock, (SOCKADDR *)&sin, sizeof(sin));

AnswerRe: TCP/IP client / serveur and Win7 Pin
Richard MacCutchan24-Jan-11 10:30
mveRichard MacCutchan24-Jan-11 10:30 
Questionwhat is the type of this pointer and also object? Pin
aesthetic.crazy24-Jan-11 4:50
aesthetic.crazy24-Jan-11 4:50 
AnswerRe: what is the type of this pointer and also object? Pin
Richard MacCutchan24-Jan-11 5:06
mveRichard MacCutchan24-Jan-11 5:06 
GeneralRe: what is the type of this pointer and also object? Pin
CPallini24-Jan-11 5:30
mveCPallini24-Jan-11 5:30 
GeneralRe: what is the type of this pointer and also object? Pin
aesthetic.crazy25-Jan-11 0:08
aesthetic.crazy25-Jan-11 0:08 
GeneralRe: what is the type of this pointer and also object? Pin
Richard MacCutchan25-Jan-11 2:31
mveRichard MacCutchan25-Jan-11 2:31 
AnswerRe: what is the type of this pointer and also object? PinPopular
Aescleal24-Jan-11 5:37
Aescleal24-Jan-11 5:37 
GeneralRe: what is the type of this pointer and also object? Pin
Chris Meech24-Jan-11 9:47
Chris Meech24-Jan-11 9:47 
QuestionApplication Error Pin
shiv@nand24-Jan-11 0:34
shiv@nand24-Jan-11 0:34 
AnswerRe: Application Error Pin
Hans Dietrich24-Jan-11 0:48
mentorHans Dietrich24-Jan-11 0:48 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 1:01
shiv@nand24-Jan-11 1:01 
GeneralRe: Application Error Pin
Andrew Brock24-Jan-11 1:07
Andrew Brock24-Jan-11 1:07 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 1:19
shiv@nand24-Jan-11 1:19 
GeneralRe: Application Error Pin
Hans Dietrich24-Jan-11 1:25
mentorHans Dietrich24-Jan-11 1:25 
AnswerRe: Application Error Pin
Stephen Hewitt24-Jan-11 1:45
Stephen Hewitt24-Jan-11 1:45 
AnswerRe: Application Error Pin
Malli_S24-Jan-11 2:11
Malli_S24-Jan-11 2:11 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 4:26
shiv@nand24-Jan-11 4:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.