you can't know the peer's connection speed unless you try to flood the peer and check the amount of data sent (very bad !) plus, that result wouldn't be, in any way, accurate, because speed always varies a bit, and the client may have other programs using his line.
when you do connect() you know the ip and port, of course. when accepting connections where's a small and accurate example, to the get the ip of the peer
Code:
//you may want this for better portability
#ifndef WIN32
typedef int SOCKET;
#define closesocket close
#endif
//get your socket
SOCKET sock = socket(AF_INET,SOCK_STREAM,IPPROTO_IP);//you can and should use 0 instead, in the 3rd parameter
//setup for listening incoming connections
struct sockaddr_in my_info;
my_info.sin_family = AF_INET;
my_info.sin_addr.s_addr = htonl(INADDR_ANY);
my_info.sin_port = htons(80);//HTTP perhaps ? :P
bind(sock,(struct sockaddr *)&my_info,sizeof(struct sockaddr_in));
listen(sock,4);
//now try to accept a peer's connection
socklen_t sizeof_sockaddr = sizeof(struct sockaddr_in);
sockaddr_in peer_info;
SOCKET new_sock = accept(sock,(struct sockaddr*)&peer_info,&sizeof_sockaddr)
printf("the peer's adress is %s\n",inet_ntoa(peer_info.sin_adr.s_addr));
closesocket(sock);
closesocket(new_sock);