How to speed up this IP sweep, Port scanner python
IP range

for this its a single IP

It is? Then why do you ask for a range? Your 'end' is not used, so just delete it.
Fail-safe scanning
Consider rearranging this:
try:
    for port in range(startport,endport):

to:
for port in range(startport,endport):
    try:

In other words, some ports may fail and others may succeed.