Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はすでに Python とソケットの使用法に精通しており、これらを介してテキストの文字列を送信できます。しかし、たとえば MP3 ファイルを送信するにはどうすればよいでしょうか。
次のコードは、文字通り要求することを実行します (thesocketストリーム ソケットが接続されていると仮定します)。
thesocket
with open('thefile.mp3', 'rb') as f: thesocket.sendall(f.read())
しかしもちろん、受信するデータの量やデータの種類などを相手が知るのに役立つ高レベルのプロトコルがなければ、あまり役に立たないでしょう。