Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

RTOS/TM4C1294NCPDT: Socket reopen bind failed

$
0
0

Part Number:TM4C1294NCPDT

Tool/software: TI-RTOS

Hi

My application is create two socket server.

First socket is use to data exchange.

Second socket is use to reopen two socket when connect, this socket will raise reopen flag, and directly close.

I use the tcp Echo example to modify.

Below is flow of shutdown two socket, tcpworker, clientfd.

when the flow is executed, will create new tcpHandler, the same with example.

        if(SocResFlag == SocketRestart)
        {
        	SocResFlag = SocketNonRestart;
        	UARTprintf("Execute restart procedure\n");
        	fdOpenSession( TaskSelf() );

        	if(fdShare((SOCKET)clientfd) == -1)
        	{
        		UARTprintf("fdShare clientfd failed\n");
        	}
        	if(fdShare((SOCKET)Socket_0) == -1)
        	{
        		UARTprintf("fdShare Socket_0 failed\n");
        	}
        	
        	if(fdShare((SOCKET)Socket_1) == -1)
        	{
        		UARTprintf("fdShare Socket_1 failed\n");
        	}
        	
        	UARTprintf("Close fd socket_clientfd\n");
            fdClose( (SOCKET)clientfd );
            fdClose( (SOCKET)Socket_0);
            fdClose( (SOCKET)Socket_1);
            UARTprintf("TaskDestroy WorkerHandle\n");
            TaskDestroy(WorkerHandle);
            UARTprintf("TaskDestroy SocketHandle\n");
            TaskDestroy(SocketHandle);
            Socket_Open_Flag = 0;
            fdCloseSession( TaskSelf() );

        }

Question is when reopen socket two socket server will bind failed.

If my flow is wrong, please tell me how to do.

Please help me to solve this.

Thank you very much.

Allen

CCS version : 6

TI-RTOS version : 2.16.1.14

NDK version : 2.25.00.09

 


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>