Socket hangup while testing 2 apps sequentially

Hello!
I am trying to automate apps in the following format:
Step 1: Download or update the app from play store
Step 2: Open the downloaded app and run the test cases on it.

I am doing this for 10 apps from shell script, I am facing socket hang up issues in between the 2 steps.

I am using the same appium port for both the apps does that matter? I searched all kinds of threads but I am not able to get through this issue. Please help me.
Thank you.

You need to use a different port for every Appium driver instance you create.

im running appium server on two different port by invoking server programmatically.
but only one device run perfect and other give error of socket crash by another party.

Are you trying to connect to two different devices at the same time? Appium doesn’t support this yet.

@cesarv
yes im doing it with TestNG.