# Re: bidirectional with Socket PDU

**URL:** <https://www.ruby-forum.com/t/re-bidirectional-with-socket-pdu/243007>\
**Category:** GNU Radio\
**Created:** [August 14, 2015, 4:33pm UTC](https://www.ruby-forum.com/t/re-bidirectional-with-socket-pdu/243007 "2015-08-14T16:33:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [August 14, 2015, 4:33pm UTC](https://www.ruby-forum.com/t/re-bidirectional-with-socket-pdu/243007/1 "2015-08-14T16:33:39Z")

</div>

> If someone has an alternative, I am all ears (I’m coming up empty).

I got it working now. If someone wants to do something similar, what I  
did was take the python example code from here:

> **[Python socket – chat server and client with code example](https://www.binarytides.com/code-chat-application-server-client-sockets-python/)**
>
> Socket based chat application In our previous article on we learned about the basics of creating a socket server and client in python. In this post we are going to write a very simple chat application in python that is powered by sockets. The chat...

(the last section of code near the bottom of the article that shows how  
to use the select function).

The example is for TCP (which worked fine), but if you want to use UDP,  
just change the line:  
s = socket.socket(socket.AF\_INET, socket.SOCK\_STREAM)  
to  
s = socket.socket(socket.AF\_INET, socket.SOCK\_DGRAM)
