Socket based TCP/UDP network stack (XSOCKETS)

XCore Project reviews, ideas, videos and proposals.
User avatar
BEBDigitalAudio
Experienced Member
Posts: 82
Joined: Thu Nov 11, 2010 7:45 pm

Socket based TCP/UDP network stack (XSOCKETS)

Post by BEBDigitalAudio »

Version: 0.7
Status: Beta
License: BSD
Download: /files/project_builds/xsockets_0v7.zip

I am mostly using UDP in my different projects : ArtNet, RTP-MIDI, Audio RTP streaming...

The first project I ported on the XMOS XTCP stack made me quickly understand that something was wrong it, when multiple UDP listeners are created.

Moreover, as I program also on Mac and Windows platforms (and due to the hardware I am currently using), I prefer a lot to work with a socket based approach.
Since I was not satisfied with the current XCore WinSock project, I decided to write this new wrapper around the XTCP stack.
This wrapper has the following characteristics :

- socket based (one socket = one listener port or one sender port)

- independent data buffer for each socket

- based on a modified/enhanced XTCP/UIP stack

- asynchronous connection between sockets thread and applications

- UDP listener sockets are able to report sender's IP address and source port

- multiple message buffering for each socket

- faster implementation than XTCP (polling period set to 1ms)
Images:


User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

Great!
Does it work without failures?
Is it more and less optimized for 32bit instruction set ?
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
BEBDigitalAudio
Experienced Member
Posts: 82
Joined: Thu Nov 11, 2010 7:45 pm

Post by BEBDigitalAudio »

I am currently using it on a real application that I am porting on the XS1, which uses 8 concurrent sockets, and I did not see any crashes up to now, on any socket.
So, the UDP seems far more stable than the original code.
TCP is not yet implemented in my code (because my application does not need it). It's the next "TODO" thing °-)

I have not yet optimized it (my first goal was to have reliable UDP connections), but I will quite probably rewrite some of the UIP code later to optimize it for the XMOS 32 bits architecture.

By the way, I plan to release the V0.1 package next week on the XCore forum (I still have some things to document).
User avatar
jason
XCore Expert
Posts: 577
Joined: Tue Sep 08, 2009 5:15 pm

Post by jason »

Nice work Benoit.
kasbah
Member++
Posts: 17
Joined: Thu Oct 14, 2010 12:07 am

Post by kasbah »

I will be using this a lot I suspect as we are building an open sound controller using UDP. I would like to be able to contribute back any improvements I make. Would you consider hosting your code on xcommons: https://github.com/XCommons-Foundation?
User avatar
BEBDigitalAudio
Experienced Member
Posts: 82
Joined: Thu Nov 11, 2010 7:45 pm

Post by BEBDigitalAudio »

Thank you for your comment Kasbah
Yes, I will GIT it, but right now, this version is not yet fully implemented. So I will wait at least until I have implemented TCP fully and the code is fully cleaned (this last thing is almost done now)

I am also writing a simple user's manual for the next release.

Do not forget to report me any problem or bug you find °-)

User avatar
BEBDigitalAudio
Experienced Member
Posts: 82
Joined: Thu Nov 11, 2010 7:45 pm

Post by BEBDigitalAudio »

Status changed to alpha release
Bugs corrected in some low level functions
New functions added in client
(Look to release_notes.txt file for more details)
User avatar
BEBDigitalAudio
Experienced Member
Posts: 82
Joined: Thu Nov 11, 2010 7:45 pm

Post by BEBDigitalAudio »

IMPORTANT MESSAGE TO ALL XSOCKETS USERS :
I am currently testing V0.5 version of xsockets, and I found a serious problem (whih already exists in V0.4, hence this message).
When the link goes down and xsockets tries to send a message, the uIP thread is blocked when it calls the ethernet_tx_server, which blocks in return the link status communication channel. A great deadlock (or deadly embrace if you prefer)
I am currently trying to find an elegant solution to this problem before I release the V0.5.
Sorry for the delay induced for this new version...
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

Have you tried it with the new Ethernet 1.4 module ?
I guess that you have acess to AVB @ XMOS.
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
BEBDigitalAudio
Experienced Member
Posts: 82
Joined: Thu Nov 11, 2010 7:45 pm

Post by BEBDigitalAudio »

Hey liltroll,
no, I did not test it now. xsockets 0.5 is still based on Ethernet 1.3, but i plan to include and test Ethernet 1.4 in xsockets 0.6 (and you are right, I am also working on AVB...)
I am also trying to figure where to find the new Ethernet 2.0 (seems to have been released by XMOS with the new XTCP stack, but no idea where to find it)