Click here to Skip to main content
15,843,623 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to display a image in an Activex webpage Pin
Richard MacCutchan24-Jan-11 11:27
mveRichard MacCutchan24-Jan-11 11:27 
GeneralRe: How to display a image in an Activex webpage Pin
yindoor24-Jan-11 17:42
yindoor24-Jan-11 17:42 
GeneralRe: How to display a image in an Activex webpage Pin
Richard MacCutchan24-Jan-11 22:17
mveRichard MacCutchan24-Jan-11 22:17 
QuestionTCP/IP client / serveur and Win7 Pin
shoppinit24-Jan-11 8:52
shoppinit24-Jan-11 8:52 
AnswerRe: TCP/IP client / serveur and Win7 Pin
TheGreatAndPowerfulOz24-Jan-11 9:22
TheGreatAndPowerfulOz24-Jan-11 9:22 
GeneralRe: TCP/IP client / serveur and Win7 Pin
shoppinit24-Jan-11 10:37
shoppinit24-Jan-11 10:37 
GeneralRe: TCP/IP client / serveur and Win7 Pin
TheGreatAndPowerfulOz25-Jan-11 14:31
TheGreatAndPowerfulOz25-Jan-11 14:31 
GeneralRe: TCP/IP client / serveur and Win7 Pin
shoppinit25-Jan-11 22:55
shoppinit25-Jan-11 22: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 11:30
mveRichard MacCutchan24-Jan-11 11:30 
Questionwhat is the type of this pointer and also object? Pin
aesthetic.crazy24-Jan-11 5:50
aesthetic.crazy24-Jan-11 5:50 
AnswerRe: what is the type of this pointer and also object? Pin
Richard MacCutchan24-Jan-11 6:06
mveRichard MacCutchan24-Jan-11 6:06 
GeneralRe: what is the type of this pointer and also object? Pin
CPallini24-Jan-11 6:30
mveCPallini24-Jan-11 6:30 
GeneralRe: what is the type of this pointer and also object? Pin
aesthetic.crazy25-Jan-11 1:08
aesthetic.crazy25-Jan-11 1:08 
GeneralRe: what is the type of this pointer and also object? Pin
Richard MacCutchan25-Jan-11 3:31
mveRichard MacCutchan25-Jan-11 3:31 
AnswerRe: what is the type of this pointer and also object? Pin
Aescleal24-Jan-11 6:37
Aescleal24-Jan-11 6:37 
GeneralRe: what is the type of this pointer and also object? Pin
Chris Meech24-Jan-11 10:47
Chris Meech24-Jan-11 10:47 
QuestionApplication Error Pin
shiv@nand24-Jan-11 1:34
shiv@nand24-Jan-11 1:34 
AnswerRe: Application Error Pin
Hans Dietrich24-Jan-11 1:48
mentorHans Dietrich24-Jan-11 1:48 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 2:01
shiv@nand24-Jan-11 2:01 
GeneralRe: Application Error Pin
Andrew Brock24-Jan-11 2:07
Andrew Brock24-Jan-11 2:07 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 2:19
shiv@nand24-Jan-11 2:19 
GeneralRe: Application Error Pin
Hans Dietrich24-Jan-11 2:25
mentorHans Dietrich24-Jan-11 2:25 
AnswerRe: Application Error Pin
Stephen Hewitt24-Jan-11 2:45
Stephen Hewitt24-Jan-11 2:45 
AnswerRe: Application Error Pin
Malli_S24-Jan-11 3:11
Malli_S24-Jan-11 3:11 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 5:26
shiv@nand24-Jan-11 5: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.