Hi Experts!
Im trying to send a packet and then receive the same packet in my client-program and in my server-program Im trying to receive and then send the same packet back.
My first problem is that I get Error code 10040 even if I use the same packetsize on both ends.
When I change this to smaller packets than received I cant make my server-program to stop. Even if the client-program have stopped the server-program is sending packets to the remote adress.
In the future Im going to have a SIP-library.
I hope that I made the problem clear and that someone can help me
Many thanks
Stefan
a piece of THE SERVER-PROGRAM:
unsigned char *recvBuf; char *ssrc;
int stream_received = 0; int port = PORT; int b = 0; int err = 0; uint32_t user_ts = 0; RtpSession *session; SessionSet *set = NULL;
session=rtp_session_new(RTP_SESSION_SENDRECV);
rtp_session_set_scheduling_mode(session,1); rtp_session_set_blocking_mode(session,1); rtp_session_set_symmetric_rtp(session,true); rtp_session_set_local_addr(session,getLocalIP(),port); rtp_session_set_payload_type(session,0); rtp_session_set_remote_addr( session, "192.168.1.102",port ); //port + 1 rtp_session_enable_adaptive_jitter_compensation(session, TRUE); rtp_session_set_recv_buf_size(session,R_PACKET_SIZE);
while(cond && b < 1000) { cout << "in outer loop, b = " << b << endl;
int k;
session_set_init(set);
session_set_set(set, session);
k = session_set_select(set, NULL, NULL); if (k == 0) cout <<"warning: session_set_select() is returning 0...\n"<<endl;
if (session_set_is_set(set, session)) { int havemore = 1;
while (havemore) {
err = rtp_session_recv_with_ts(session,recvBuf,R_PACKET_SIZE,user_ts,&havemore);
if (err > 0) stream_received = 1; if ((stream_received) && (err > 0)) { session_set_init(set); session_set_set(set,session);
k = session_set_select(NULL, set, NULL);
if (k > 0) { if (rtp_session_send_with_ts(session,recvBuf,R_PACKET_SIZE,user_ts) < 1) { return; } else { cout<<"sending"<<endl; } }
} user_ts+=err; }//while
}//if
++b; }//while cond
rtp_session_destroy(session); session_set_destroy(set);
ortp_exit(); ortp_global_stats_display();
}
|