plzzz help! i did the work need

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Closed Thread

Join Date: Jul 2003
Posts: 58
Reputation: fakespike is an unknown quantity at this point 
Solved Threads: 0
fakespike fakespike is offline Offline
Junior Poster in Training

plzzz help! i did the work

 
0
  #1
Sep 27th, 2003
well i have been working on a server client program and i got the server working but the client isnt.

Program Flow of a simple TCP client:
1)Initialize WinSock library using WSAStartup()
2)Create a IPPROTO_TCP SOCKET using socket()
3)Connect to the server using the socket we created, using connect()
4)Close the socket connection using closesocket()
5)De-Initialize WinSock using WSACleanup()

void main()
{
// Initialize WinSock
int wsaret=WSAStartup(0x101,&wsaData);
if(wsaret)
return;
//Create the SOCKET

SOCKET conn;
conn=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(conn==INVALID_SOCKET)
return;
//connecting to server
//problem here
connect(conn,(struct sockaddr*)&127.0.0.1,sizeof(127.0.0.1))

//clean up mess
closesocket(conn);
WSACleanup();
}

thats the code.

these are the erros i get.

error C2065: 'wsaData' : undeclared identifier
error C2101: '&' on constant
error C2440: 'type cast' : cannot convert from 'const double' to 'struct sockaddr *'
There is no context in which this conversion is possible
error C2143: syntax error : missing ')' before 'constant'
error C2660: 'connect' : function does not take 2 parameters
error C2059: syntax error : ')'
Error executing cl.exe.

client.exe - 6 error(s), 0 warning(s)

any help will be greatly apprecaited. thx
Last edited by fakespike; Sep 27th, 2003 at 5:28 pm.
Quick reply to this message  
Join Date: Feb 2003
Posts: 129
Reputation: Bob is an unknown quantity at this point 
Solved Threads: 1
Team Colleague
Bob Bob is offline Offline
Team Member

Re: plzzz help! i did the work need

 
0
  #2
Oct 4th, 2003
> error C2065: 'wsaData' : undeclared identifier

Looks like a duplicate post. Where is wsaData declared? Your compiler is trying to tell you that you're using an identifier that hasn't been declared anywhere, it's not known. Fix this error first, then try compiling again.
Quick reply to this message  
Join Date: Feb 2002
Posts: 12,041
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: plzzz help! i did the work need

 
0
  #3
Oct 4th, 2003
Indeed, this is a duplicate post. Please direct all future responses to http://www.daniweb.com/forums/thread1190.html (this way, all responses to the thread are together)

Thanks!
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Quick reply to this message  
Closed Thread

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC