Well i learned this on emonth back in Computer Networks. For this you will need to programs one server and other reciver. the coding of which i give below:: Here i will mention the coding for transmitting a character. If you still need to transmiot a file tell me, i will try to send you the program for it as well.
int port = 0;
char value = 'A';
printf("Value %c sent to port number %d\n", value, port);
printf("Received value is %c",result);
printf("your character has been received:%c", result);