Who are your users? There is no best answer here, at least that we can fully provide. You need to examine the situation from your users' perspective and from their work flow -- this will guide you in finding the most appropriate method of input.
The fact that you're asking someone to set up a "UDP Socket" implies that my grandmother isn't going to be using this application. The type of information you are requesting from the user would seem to imply that they know what their doing with a network configuration.
On the other hand, if you do expect my grandmother to be able to use this, you have a much bigger problem with asking her to enter a "UDP Socket" in the first place.
Neither option expresses what exactly you are asking for in the text fields.
In Option 2 there is no instruction that I should enter both an IP and a port, or how that should be done. While ":" is a common address/port separator, it is not the only one used. Some users will undoubtedly enter just an IP address or will use an alternate separator without such guidance.
While Option 1 is better, in that it gives better guidance in that you're seeking both an IP address and port, the fields are still not labeled. Knowing that your users are likely familiar with a socket definition, you might be able to get away with avoiding labels... but why do that?
download bmml source – Wireframes created with Balsamiq Mockups
Now I know exactly what to enter and where to enter it!
What you're running into with your current two options is an increase in the Gulf of Evaluation. You're providing artifacts to the user, but not explaining fully what they are. As a result the user must make additional effort in determining the intentions of those artifacts. Reducing the gulf of evaluation reduces the cognitive load required for the user to figure out the system, and makes their job easier.