LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-25-2010, 05:37 AM   #1
vbx_wx
Member
 
Registered: Feb 2010
Posts: 181

Rep: Reputation: 16
Result to large error in c++


I am getting this error when i try to connect a client to a server in windwos ,anybody knows why ?
 
Old 03-25-2010, 08:58 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
I think that you need to provide a little more information.

Is this a program that you have written?
If so what is the appropriate code.
If not what program are you using?
Is it a compile time or a run time error?
Can you provide a little more detail about the error, and what you were expecting to see.
 
Old 03-25-2010, 10:43 AM   #3
cola
Senior Member
 
Registered: Sep 2007
Posts: 1,045

Rep: Reputation: 65
Quote:
Originally Posted by vbx_wx View Post
I am getting this error when i try to connect a client to a server in windwos ,anybody knows why ?
Post complete code.
 
Old 03-25-2010, 10:44 AM   #4
vbx_wx
Member
 
Registered: Feb 2010
Posts: 181

Original Poster
Rep: Reputation: 16
yes,is my code,its a run time error,and i am getting the error in the connect() function...i test it in linux,and iit works fine,but in windows it give sme this error.

Code:
Wsk::Wsk() :sock(-1)
	{
		memset(&addr , 0 , sizeof(addr));
		#ifdef WINDOWS
		if(WSAStartup(MAKEWORD(2 , 0) , &wsaData) != 0)
		{
			throw ExcepClass("Startup Failed");
		}
		#endif
	}
	Wsk::~Wsk()
	{
		::close(sock);
	}
	bool Wsk::create()
	{
		if((sock = socket(AF_INET , SOCK_STREAM , 0)) == -1)
		{
			return false;
		}
		else
			return true;
	}

bool Wsk::connect(const string host , const int port)
	{
		addr.sin_family = AF_INET;
		addr.sin_port = htons(port);

		int status = ::connect(sock , (sockaddr * ) &addr , sizeof(addr));
		if(status == -1)
		{
			cout << strerror(errno) << endl;
			return false;
		}
		else
			cout << "Connected to server"<< endl;
			return true;
	}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS Large File Copies Fail - Error writing to file: Input/output error deck- Linux - Server 10 08-01-2022 02:30 AM
LXer: This week at LWN: Large pages, large blocks, and large problems LXer Syndicated Linux News 0 09-27-2007 11:40 AM
snmpwalk no result and no error packets Linux - Networking 2 01-07-2007 06:23 PM
c++ ostream error, messag rot large to trakc down location of error. exodist Programming 2 06-13-2004 06:35 PM
cannot configure ppp0; error 2; result=no internet robertn Linux - Networking 0 05-25-2004 01:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration