how do i slove a broken pipe error while communicating using socket programming

I am trying to learn socket programming ,So i thought to write a code to communicate between two machines,i wrote a code for client and used netcat(a tool for listning incoming connection) to listen connection,and it worked fine.So,I decided to write my own listner.when i executed listner it behaved normal and worked as expected but as soon as i tried to send a messege it threw an error, BrokenPipeError: [Errno 32] Broken pipe and terminated programming,how can i solve this and make systems communicate. Note: I am using a same machine for listner and client both which should not be a problem because with netcat its working fine

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum