Click here to Skip to main content
15,891,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Speech sample not running.... Pin
Richard MacCutchan12-Dec-10 9:37
mveRichard MacCutchan12-Dec-10 9:37 
AnswerRe: Speech sample not running.... Pin
Emilio Garavaglia12-Dec-10 9:42
Emilio Garavaglia12-Dec-10 9:42 
QuestionUsing Filtering Functions in Win32 App Pin
Coder-12345612-Dec-10 3:14
Coder-12345612-Dec-10 3:14 
AnswerRe: Using Filtering Functions in Win32 App Pin
Niklas L12-Dec-10 3:23
Niklas L12-Dec-10 3:23 
GeneralRe: Using Filtering Functions in Win32 App Pin
Coder-12345612-Dec-10 5:07
Coder-12345612-Dec-10 5:07 
GeneralRe: Using Filtering Functions in Win32 App Pin
Niklas L12-Dec-10 8:09
Niklas L12-Dec-10 8:09 
GeneralRe: Using Filtering Functions in Win32 App Pin
Coder-12345612-Dec-10 21:27
Coder-12345612-Dec-10 21:27 
QuestionHow can use Socket Connection Timeout? Pin
Le@rner11-Dec-10 1:40
Le@rner11-Dec-10 1:40 
Hi all,

Is it possilbe to set socket connection timeout? For e.g. If I want to connect to some host with socket connection within 5 seconds if I cant connect within 5 seconds,function return from this point without process further operation.

I have checked socket class, apprently I cant find out some way for connection timeout ? Can anybody help me regarding this?

i m using this for socket connection

WSADATA wsaData;
	if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
	{
		int i = WSAGetLastError();
		
	}

	sock = socket(AF_INET,SOCK_STREAM,0);
	if(sock==-1)
	{
		int i = WSAGetLastError();
		
	}

	USES_CONVERSION;
	struct sockaddr_in my_addr;
	memset(&my_addr,0,sizeof(my_addr));

	my_addr.sin_family = AF_INET; // host byte order
	my_addr.sin_port = htons(MYPORT); // short, network byte order
	LPSTR lpszAscii = T2A((LPTSTR)ServerName);
	my_addr.sin_addr.s_addr = inet_addr(lpszAscii);
	if (my_addr.sin_addr.s_addr == INADDR_NONE)
	{
		LPHOSTENT lphost;
		lphost = gethostbyname(lpszAscii);
		if (lphost != NULL)
		{
			my_addr.sin_addr.s_addr = ((LPIN_ADDR)lphost->h_addr)->s_addr;
		}
		else
		{
			WSASetLastError(WSAEINVAL);
			return WSAEINVAL;
		}
	}
	if(connect(sock,(struct sockaddr *)&my_addr,sizeof(struct sockaddr))==-1)
	{
		return FALSE;
	}


please help me for this.

thanks in advance.
AnswerRe: How can use Socket Connection Timeout? Pin
yu-jian15-Dec-10 3:13
yu-jian15-Dec-10 3:13 
GeneralRe: How can use Socket Connection Timeout? Pin
Le@rner15-Dec-10 17:19
Le@rner15-Dec-10 17:19 
QuestionUser defined message , exeption at the handler return [modified] Pin
timbk10-Dec-10 3:05
timbk10-Dec-10 3:05 
AnswerRe: User defined message , exeption at the hander return Pin
Cool_Dev10-Dec-10 3:25
Cool_Dev10-Dec-10 3:25 
GeneralRe: User defined message , exeption at the hander return Pin
timbk10-Dec-10 4:09
timbk10-Dec-10 4:09 
AnswerRe: User defined message , exeption at the hander return Pin
Maximilien10-Dec-10 3:48
Maximilien10-Dec-10 3:48 
GeneralRe: User defined message , exeption at the hander return Pin
timbk10-Dec-10 4:24
timbk10-Dec-10 4:24 
AnswerRe: User defined message , exeption at the handler return Pin
«_Superman_»10-Dec-10 7:50
professional«_Superman_»10-Dec-10 7:50 
GeneralRe: User defined message , exeption at the handler return Pin
timbk10-Dec-10 7:56
timbk10-Dec-10 7:56 
AnswerAdded information Pin
timbk10-Dec-10 8:09
timbk10-Dec-10 8:09 
AnswerMore Added Info Pin
timbk10-Dec-10 9:30
timbk10-Dec-10 9:30 
GeneralRe: More Added Info Pin
Richard MacCutchan10-Dec-10 23:01
mveRichard MacCutchan10-Dec-10 23:01 
AnswerRe: User defined message , exeption at the handler return Pin
Gary R. Wheeler11-Dec-10 1:09
Gary R. Wheeler11-Dec-10 1:09 
AnswerVC++ debugging with latest Avira Antivir Pin
Alexander Fedorov10-Dec-10 2:33
Alexander Fedorov10-Dec-10 2:33 
QuestionUsing WM_USER, WM_APP or RegisterWindowMessage Pin
yccheok9-Dec-10 21:25
yccheok9-Dec-10 21:25 
AnswerRe: Using WM_USER, WM_APP or RegisterWindowMessage [modified] Pin
CPallini9-Dec-10 22:08
mveCPallini9-Dec-10 22:08 
GeneralRe: Using WM_USER, WM_APP or RegisterWindowMessage Pin
Rajesh R Subramanian9-Dec-10 23:43
professionalRajesh R Subramanian9-Dec-10 23:43 

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.