Winsock Problem

This is a discussion on Winsock Problem within the Networking/Device Communication forums, part of the General Programming Boards category; Hi, Im having some problems with a basic winsock server, when my servers running and i open a raw telnet ...

  1. #1
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339

    Winsock Problem

    Hi,

    Im having some problems with a basic winsock server, when my servers running and i open a raw telnet connection to it, i can only send single characters rather than full strings which is what i need.

    this is my server code for recived data:

    Code:
    void Get_Message(int clIndex)
    {
    	int nRet;
    	char data[1024];
    
    	nRet = recv(Client[clIndex].ClientSocket, data, sizeof(data), 0);
    	char *ClientIp = inet_ntoa(Client[clIndex].ClientAddr.sin_addr);
    
    	if (nRet == 0) {
    		Log("Client disconnected: "), Log(ClientIp), Log("\n");
    		Disconnect(clIndex);
    	}
    	else {
    		Log("<"), Log(ClientIp), Log("> ");
    		data[nRet] = '\0';
    		// Start data output
    		cout << data;
    		Log("\n");
    		
    	}
    }

    As i say my code works fine, but in a telnet connection i can only send one character at a time rather than a string that i need, the server is simply getting it character by character


    Thanks for any help guys
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Well.....as of recently we have a board specifically for this type of question.

    Since I know next to nothing about winsock, perhaps it would be best answered and moved to the network board.


  3. #3
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Dam, sorry i never noticed that board, can someone please move this
    TNT
    You Can Stop Me, But You Cant Stop Us All

  4. #4
    Xei
    Xei is offline
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    SOCK_RAW sockets are generally not intended for the purpose you are using it for. Use SOCK_STREAM. Also, SOCK_RAW is a poor decision to use in your applications simply because it requires administrative privileges.
    "What are you after - the vague post of the week award?" - Salem
    IPv6 Ready.
    Travel the world, meet interesting people...kill them.
    Trying to fix or change something, only guaruntees and perpetuates its existence.
    I don't know about angels, but it is fear that gives men wings.
    The problem with wanting something is the fear of losing it, or never having it. The thought makes you weak.

    E-Mail Xei

  5. #5
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hi thanks do u have any tutorials on sock_streams or can you reccomend any good books covering them in detail,

    Thanks
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

  6. #6
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Go to google and search for Beej's Guide to Networking or something like that. Its a magnificent book that teaches all about stream and datagram sockets (sorry but I dont have the link on me).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Where do I initialize Winsock and catch messages for it?
    By Lithorien in forum Windows Programming
    Replies: 10
    Last Post: 12-30-2004, 11:11 AM
  2. Winsock packet problem
    By Rare177 in forum Windows Programming
    Replies: 7
    Last Post: 10-05-2004, 04:53 PM
  3. Winsock Problem
    By Noxir in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2004, 10:50 AM
  4. WinSock Problem
    By loobian in forum C++ Programming
    Replies: 1
    Last Post: 02-09-2002, 10:25 AM
  5. Small Winsock problem...
    By SyntaxBubble in forum C++ Programming
    Replies: 0
    Last Post: 02-09-2002, 09:09 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21