@Jake012345
There you go (and thank you), that is much more precise and better to understand for the reader
I would like to write a program that can send text messages and files to another copy of the program.
You wish to use _different_ methods of sending data.
And preferably the host should be able to serve multiple clients.
You wish to a) supply multiple sockets (clients) all at once and/or b) one socket (client) after the other.
Depending on what you want things can get complicated because option a would require to implement threads while option b could do without using threads.
I don't really care what kind of connection this creates, but larger files may require a TCP connection.
The examples used in the earlier threads assumed TCPBlockSocket connections (TCP).
But as written in the other thread: it is perfectly ok to switch from sending strings to sending raw data (read: streams) and back again, over the same socket but_ you_ would have to come up with a communication protocol. I even provided an example on how such communication protocol (in theory) _could_ look like.
That is why there exists ready made (communication) protocols such as FTP, TFTP,
HTML HTTP etc. These protocols where once made up and the RFC's determine how these clients and servers need to "talk" (communicate) to each other. That "talking" between client and servers is also known as (communication)-protocol.
You would have to invent your own communication protocol in order to make things work exactly the way how you want it to work, just as any other existing protocols (FTP/TFPT/
HTMLHTTP/etc) do. There is not an example in the world that is able to teach that for you. You can always have a look at already existing protocols (RFC's/code) and read how they implemented their communications, but i doubt they would be helpful for your specific situation (as you stated earlier that the extra's in the code seem to confuse you).
edit: corrected html to read http, i was thinking http but wrote html