Sign in to follow this  

Telnet Chat Server

Recommended Posts

i am trying to make a simple telnet chat server ... i .. socket() .. bind() .. listen() .. the accept() here goes the problem i want every one to send in turn ... :S cant figure it out ... everything is mixed and i get stupid outputs i did that ...

		sockaddr_in clientaddr;
		int addrlen = sizeof(sockaddr_in);
		if((clientsock = accept(mainsock , (sockaddr*)&clientaddr , &addrlen))!= SOCKET_ERROR){
			char buffer[1000] = { 0 };
			send(clientsock ,welcomeMessage , strlen(welcomeMessage) ,0);
			cout<<"got connection from "<<inet_ntoa(clientaddr.sin_addr)<<endl;
			int recieved = recv(clientsock , buffer , 80 ,0);
				char dataToSend[1000] = { 0 };
				cout<<"\t\t: ";cin>>dataToSend;
				send(clientsock,dataToSend , strlen(dataToSend),0);
				recieved = recv(clientsock , buffer , 80 ,0);


Thanks in Advance

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this