Посмотрите функцию tcp_write() Из какого-то примера. Если мало -
могу весь куда-нить выложить.
/** * @brief function used to send data * @param tpcb: tcp control block * @param es: pointer on structure of type echoclient containing info on data * to be sent * @retval None */ static void tcp_echoclient_send(struct tcp_pcb *tpcb, struct echoclient * es) { struct pbuf *ptr; err_t wr_err = ERR_OK; while ((wr_err == ERR_OK) && (es->p_tx != NULL) && (es->p_tx->len <= tcp_sndbuf(tpcb))) { /* get pointer on pbuf from es structure */ ptr = es->p_tx; /* enqueue data for transmission */ wr_err = tcp_write(tpcb, ptr->payload, ptr->len, 1); if (wr_err == ERR_OK) { /* continue with next pbuf in chain (if any) */ es->p_tx = ptr->next; if(es->p_tx != NULL) { /* increment reference count for es->p */ pbuf_ref(es->p_tx); } /* free pbuf: will free pbufs up to es->p (because es->p has a reference count > 0) */ pbuf_free(ptr); } else if(wr_err == ERR_MEM) { /* we are low on memory, try later, defer to poll */ es->p_tx = ptr; } else { /* other problem ?? */ } } }