for (int a = size, readsize = 0; a > 0; a -= readsize) { if (!Readfile(...&readsize)) { error(); } int sendsize; do { int sent = send(...buffer+sendsize...,readsize-sendsize); if (sent < 0) { error(); sendsize += sent; } while (sendsize < readsize); } 最低でもこのくらいだろ