Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Cannot bind port (Address already in use)(When I tried this example, I found that I tried to bind UDP to a default port, but it always failed. What might be the cause?)
Cannot bind port (Address already in use) [message #1871034] Fri, 13 September 2024 02:56 Go to next message
Hongjun Zhao is currently offline Hongjun ZhaoFriend
Messages: 1
Registered: September 2024
Junior Member
module HelloUDP {

import from UDPasp_PortType all;
import from UDPasp_Types all;

type component MyMTC
{
port UDPasp_PT udpport_advanced;
}




testcase tc_UDP() runs on MyMTC system MyMTC
{
map(mtc:udpport_advanced, system:udpport_advanced);

var ASP_UDP_open open := {"localhost", 2222, "localhost", 2222};
log(open);
udpport_advanced.send(open);
var ASP_UDP_open_result open_result;
udpport_advanced.receive(ASP_UDP_open_result:?) -> value open_result;
log("ELNRNAG");
log(open_result);


var ASP_UDP_message pdu := {'A1A2A3A4A5'O,omit,omit, open_result.id};
udpport_advanced.send(pdu);

log(pdu);
log("SENT");

var ASP_UDP_message inPdu;
udpport_advanced.receive(ASP_UDP_message:?) -> value inPdu;

log("RECEIVED");
log(inPdu);
log("ELNRNAG1");
unmap(mtc:udpport_advanced, system:udpport_advanced);
log("ELNRNAG2");
setverdict(pass);
log("ELNRNAG3");
}

control
{
execute(tc_UDP());
execute(tc_UDP());
}


}


ttcn3_start: Starting the test suite
ttcn3_start: warning: no configuration file was specified or the file name was misspelled
spawn /home/zhj/Desktop/TITAN/titan.core-10.1.2/Install/bin/mctr_cli

*************************************************************************
* TTCN-3 Test Executor - Main Controller 2 *
* Version: 10.1.2 *
* Copyright (c) 2000-2024 Ericsson Telecom AB *
* All rights reserved. This program and the accompanying materials *
* are made available under the terms of the Eclipse Public License v2.0 *
* which accompanies this distribution, and is available at *
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html *
*************************************************************************

MC@ubuntu: Unix server socket created successfully.
MC@ubuntu: Listening on TCP port 35415.
MC2> ubuntu is the default
spawn ./HelloUDP ubuntu 35415
TTCN-3 Host Controller (parallel mode), version 10.1.2
MC@ubuntu: New HC connected from 127.0.0.1 [127.0.0.1]. ubuntu: Linux 5.4.0-150-lowlatency on x86_64.
cmtc
MC@ubuntu: Downloading configuration file to all HCs.
MC@ubuntu: Configuration file was processed on all HCs.
MC@ubuntu: Creating MTC on host 127.0.0.1.
MC@ubuntu: MTC is created.
MC2> smtc HelloUDP
MC2> MTC@ubuntu: Execution of control part in module HelloUDP started.
MTC@ubuntu: Test case tc_UDP started.
MTC@ubuntu: HelloUDP.ttcn:20: Dynamic test case error: Cannot bind port (Address already in use)
MTC@ubuntu: Test case tc_UDP finished. Verdict: error
MTC@ubuntu: Test case tc_UDP started.
MTC@ubuntu: HelloUDP.ttcn:20: Dynamic test case error: Cannot bind port (Address already in use)
MTC@ubuntu: Test case tc_UDP finished. Verdict: error
MTC@ubuntu: Execution of control part in module HelloUDP finished.
MC@ubuntu: Test execution finished.
emtc
MC@ubuntu: Terminating MTC.
MTC@ubuntu: Verdict statistics: 0 none (0.00 %), 0 pass (0.00 %), 0 inconc (0.00 %), 0 fail (0.00 %), 2 error (100.00 %).
MTC@ubuntu: Test execution summary: 2 test cases were executed. Overall verdict: error
MC@ubuntu: MTC terminated.
MC2> exit
MC@ubuntu: Shutting down session.
MC@ubuntu: Shutdown complete.
  • Attachment: example.zip
    (Size: 2.16MB, Downloaded 16 times)
Re: Cannot bind port (Address already in use) [message #1871313 is a reply to message #1871034] Fri, 20 September 2024 06:44 Go to previous message
Harald Welte is currently offline Harald WelteFriend
Messages: 148
Registered: July 2017
Location: Berlin, Germany
Senior Member

What you are seeing is not TTCN-3 related, but a standard POSIX/UNIX/Linux socket API error message: The port/address you're trying to bind to is already used by some other socket / process.

Try something like "netstat -uan" or "ss" or "lsof -iUDP" to check which ports are used [and by whom, in case of lsof]
Previous Topic:Eclipse gitlab rate limiting breaking CI jobs using TITAN repos
Goto Forum:
  


Current Time: Sun Oct 06 20:13:37 GMT 2024

Powered by FUDForum. Page generated in 0.03533 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top