Sockets?

I use read () and write() for text, but how do I send non-text through sockets? i.e. files, audio video etc.
I have no problem obtaining the audio I use SFML, but what function do I use to integrate it with sockets
I am on a Mac and using the kernel for socket functions
You read your file using binary mode and then you send that buffer you can send a string like this:

filename/type/binary_data

helloworld.txt/txt/this is a test.

On the server side you should split that string and there you go.

I'm not sure how to use sockets on mac but it's the same idea.
so I just convert to binary and send the binary?
thanks
Topic archived. No new replies allowed.