123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- %description:
- Tests UDPSocket::bind() can not be called more than once on a socket.
- %#--------------------------------------------------------------------------------------------------------------
- %file: TestApp.cc
- #include "inet/transportlayer/contract/udp/UDPSocket.h"
- #include "inet/transportlayer/contract/udp/UDPControlInfo_m.h"
- using namespace inet;
- namespace UDPSocket_2 {
- class TestApp : public cSimpleModule
- {
- public:
- TestApp() : cSimpleModule(65536) {}
- protected:
- virtual void activity();
- };
- Define_Module(TestApp);
- void TestApp::activity()
- {
- UDPSocket s;
- s.setOutputGate(gate("udpOut"));
- s.bind(100);
- s.bind(200); // will fail
- }
- }
- %#--------------------------------------------------------------------------------------------------------------
- %file: TestApp.ned
- import inet.applications.contract.IUDPApp;
- simple TestApp like IUDPApp
- {
- gates:
- input udpIn;
- output udpOut;
- }
- %#--------------------------------------------------------------------------------------------------------------
- %inifile: omnetpp.ini
- [General]
- ned-path = .;../../../../src;../../lib
- network = SimpleTestNetwork
- cmdenv-express-mode = false
- cmdenv-event-banner-details = true
- #omnetpp 5.0 - 5.1 compatibility:
- eventlog-file = "${resultdir}/${configname}-${runnumber}.elog"
- output-scalar-file = "${resultdir}/${configname}-${runnumber}.sca"
- output-vector-file = "${resultdir}/${configname}-${runnumber}.vec"
- snapshot-file = "${resultdir}/${configname}-${runnumber}.sna"
- **.client.numUdpApps = 1
- **.client.udpApp[0].typename = "TestApp"
- %exitcode: 1
- %#--------------------------------------------------------------------------------------------------------------
- %postrun-command: grep "<!>" test.* > test_err.out || true
- %#--------------------------------------------------------------------------------------------------------------
- %contains-regex: test_err.out
- (<!> Error in module \(inet::UDP\) SimpleTestNetwork\.client\.udp \(id=\d+\) at event \#\d+, t=0: bind: socket is already bound \(sockId=\d+\).)|(<!> Error: bind: socket is already bound \(sockId=\d+\) -- in module \(inet::UDP\) SimpleTestNetwork\.client\.udp \(id=\d+\), at t=0s, event \#\d+)
- %#--------------------------------------------------------------------------------------------------------------
- %# %not-contains: stdout
- %# undisposed object:
- %# %not-contains: stdout
- %# -- check module destructor
- %#--------------------------------------------------------------------------------------------------------------
|