Index: EcnlProtoTool/trunk/asp3_dcre/tinet/tinet.trb
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/tinet/tinet.trb	(revision 321)
+++ EcnlProtoTool/trunk/asp3_dcre/tinet/tinet.trb	(revision 331)
@@ -47,39 +47,58 @@
 $tinetCfgH.add()
 
-$cfgData[:TCP_CRE_REP].each do |key, params|
-	$tinetCfgH.add("#define #{params[:tcp4_repid]}	#{params[:tcp4_repid].val}")
-end
+$tinetCfgH.add("#define TNUM_TCP6_REPID	#{$cfgData[:TCP6_CRE_REP].size + $cfgData[:VRID_TCP6_REP].size}")
+$tinetCfgH.add("#define TNUM_TCP4_REPID	#{$cfgData[:TCP_CRE_REP].size + $cfgData[:VRID_TCP_REP].size}")
+$tinetCfgH.add("#define TNUM_TCP_REPID	#{$cfgData[:TCP6_CRE_REP].size + $cfgData[:VRID_TCP6_REP].size + $cfgData[:TCP_CRE_REP].size + $cfgData[:VRID_TCP_REP].size}")
+$tinetCfgH.add()
+
+$tinetCfgH.add("#define TNUM_TCP6_CEPID	#{$cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}")
+$tinetCfgH.add("#define TNUM_TCP4_CEPID	#{$cfgData[:TCP_CRE_CEP].size + $cfgData[:VRID_TCP_CEP].size}")
+$tinetCfgH.add("#define TNUM_TCP_CEPID	#{$cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size + $cfgData[:TCP_CRE_CEP].size + $cfgData[:VRID_TCP_CEP].size}")
+$tinetCfgH.add()
+
+$tinetCfgH.add("#define TNUM_UDP6_CEPID	#{$cfgData[:UDP6_CRE_CEP].size + $cfgData[:VRID_UDP6_CEP].size}")
+$tinetCfgH.add("#define TNUM_UDP4_CEPID	#{$cfgData[:UDP_CRE_CEP].size + $cfgData[:VRID_UDP_CEP].size}")
+$tinetCfgH.add("#define TNUM_UDP_CEPID	#{$cfgData[:UDP6_CRE_CEP].size + $cfgData[:VRID_UDP6_CEP].size + $cfgData[:UDP_CRE_CEP].size + $cfgData[:VRID_UDP_CEP].size}")
+$tinetCfgH.add()
+
 $cfgData[:TCP6_CRE_REP].each do |key, params|
 	$tinetCfgH.add("#define #{params[:tcp6_repid]}	#{params[:tcp6_repid].val}")
 end
-$cfgData[:TCP_CRE_CEP].each do |key, params|
-	$tinetCfgH.add("#define #{params[:tcp4_cepid]}	#{params[:tcp4_cepid].val}")
-end
+$cfgData[:VRID_TCP6_REP].each do |key, params|
+	$tinetCfgH.add("#define #{params[:vrid_tcp6_repid]}	#{params[:vrid_tcp6_repid].val + $cfgData[:TCP6_CRE_REP].size}")
+end
+$cfgData[:TCP_CRE_REP].each do |key, params|
+	$tinetCfgH.add("#define #{params[:tcp4_repid]}	#{params[:tcp4_repid].val + $cfgData[:TCP6_CRE_REP].size + $cfgData[:VRID_TCP6_REP].size}")
+end
+$cfgData[:VRID_TCP_REP].each do |key, params|
+	$tinetCfgH.add("#define #{params[:vrid_tcp4_repid]}	#{params[:vrid_tcp4_repid].val + $cfgData[:TCP_CRE_REP].size + $cfgData[:TCP6_CRE_REP].size + $cfgData[:VRID_TCP6_REP].size}")
+end
+$tinetCfgH.add()
+
 $cfgData[:TCP6_CRE_CEP].each do |key, params|
 	$tinetCfgH.add("#define #{params[:tcp6_cepid]}	#{params[:tcp6_cepid].val}")
 end
-$cfgData[:UDP_CRE_CEP].each do |key, params|
-	$tinetCfgH.add("#define #{params[:udp4_cepid]}	#{params[:udp4_cepid].val}")
-end
+$cfgData[:VRID_TCP6_CEP].each do |key, params|
+	$tinetCfgH.add("#define #{params[:vrid_tcp6_cepid]}	#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}")
+end
+$cfgData[:TCP_CRE_CEP].each do |key, params|
+	$tinetCfgH.add("#define #{params[:tcp4_cepid]}	#{params[:tcp4_cepid].val + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}")
+end
+$cfgData[:VRID_TCP_CEP].each do |key, params|
+	$tinetCfgH.add("#define #{params[:vrid_tcp4_cepid]}	#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}")
+end
+$tinetCfgH.add()
+
 $cfgData[:UDP6_CRE_CEP].each do |key, params|
 	$tinetCfgH.add("#define #{params[:udp6_cepid]}	#{params[:udp6_cepid].val}")
 end
-$cfgData[:VRID_TCP4_REP].each do |key, params|
-	$tinetCfgH.add("#define #{params[:vrid_tcp4_repid]}	#{params[:vrid_tcp4_repid].val + $cfgData[:TCP_CRE_REP].size}")
-end
-$cfgData[:VRID_TCP4_CEP].each do |key, params|
-	$tinetCfgH.add("#define #{params[:vrid_tcp4_cepid]}	#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size}")
-end
-$cfgData[:VRID_TCP6_REP].each do |key, params|
-	$tinetCfgH.add("#define #{params[:vrid_tcp6_repid]}	#{params[:vrid_tcp6_repid].val + $cfgData[:TCP6_CRE_REP].size}")
-end
-$cfgData[:VRID_TCP6_CEP].each do |key, params|
-	$tinetCfgH.add("#define #{params[:vrid_tcp6_cepid]}	#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}")
-end
-$cfgData[:VRID_UDP4_CEP].each do |key, params|
-	$tinetCfgH.add("#define #{params[:vrid_udp4_cepid]}	#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size}")
-end
 $cfgData[:VRID_UDP6_CEP].each do |key, params|
 	$tinetCfgH.add("#define #{params[:vrid_udp6_cepid]}	#{params[:vrid_udp6_cepid].val + $cfgData[:UDP6_CRE_CEP].size}")
+end
+$cfgData[:UDP_CRE_CEP].each do |key, params|
+	$tinetCfgH.add("#define #{params[:udp4_cepid]}	#{params[:udp4_cepid].val + $cfgData[:UDP6_CRE_CEP].size + $cfgData[:VRID_UDP6_CEP].size}")
+end
+$cfgData[:VRID_UDP_CEP].each do |key, params|
+	$tinetCfgH.add("#define #{params[:vrid_udp4_cepid]}	#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size + $cfgData[:UDP6_CRE_CEP].size + $cfgData[:VRID_UDP6_CEP].size}")
 end
 $tinetCfgH.add()
@@ -110,9 +129,6 @@
 #include <netinet/in_itron.h>
 #include <netinet/ip.h>
-#include <netinet/ip6.h>
 #include <netinet/tcp.h>
-#include <netinet/tcp_timer.h>
 #include <netinet/tcp_var.h>
-#include <netinet/tcp_fsm.h>
 #include <netinet/udp_var.h>
 
@@ -130,12 +146,65 @@
 end
 
+$tinetCfgC.add()
+$tinetCfgC.add("const ID tmax_tcp_repid = (TMIN_TCP_REPID + TNUM_TCP6_REPID + TNUM_TCP4_REPID - 1);")
+
+$tinetCfgC.add()
+$tinetCfgC.add("#if defined(SUPPORT_INET6) && defined(SUPPORT_INET4)")
+$tinetCfgC.add("const ID tmax_tcp6_repid = (TMIN_TCP6_REPID + TNUM_TCP6_REPID - 1);")
+$tinetCfgC.add("const ID tmax_tcp4_repid = (TMIN_TCP4_REPID + TNUM_TCP4_REPID - 1);")
+$tinetCfgC.add("#endif")
+
+$tinetCfgC.add()
+$tinetCfgC.add("const ID tmax_tcp_cepid = (TMIN_TCP_CEPID + TNUM_TCP6_CEPID + TNUM_TCP4_CEPID - 1);")
+
+$tinetCfgC.add()
+$tinetCfgC.add("#if defined(SUPPORT_INET6) && defined(SUPPORT_INET4)")
+$tinetCfgC.add("const ID tmax_tcp6_cepid = (TMIN_TCP_CEPID + TNUM_TCP6_CEPID - 1);")
+$tinetCfgC.add("const ID tmax_tcp4_cepid = (TMIN_TCP_CEPID + TNUM_TCP4_CEPID - 1);")
+$tinetCfgC.add("#endif")
+
+$tinetCfgC.add()
+$tinetCfgC.add("const ID tmax_udp_cepid = (TMIN_UDP_CEPID + TNUM_UDP6_CEPID + TNUM_UDP4_CEPID - 1);")
+
+$tinetCfgC.add()
+$tinetCfgC.add("#if defined(SUPPORT_INET6) && defined(SUPPORT_INET4)")
+$tinetCfgC.add("const ID tmax_udp6_cepid = (TMIN_UDP6_CEPID + TNUM_UDP6_CEPID - 1);")
+$tinetCfgC.add("const ID tmax_udp4_cepid = (TMIN_UDP4_CEPID + TNUM_UDP4_CEPID - 1);")
+$tinetCfgC.add("#endif")
+
+#	// TCP (IPv6) 受付口
+$sem_tcp_rep_lock_id = 0
+if $cfgData[:TCP6_CRE_REP].size > 0 || $cfgData[:VRID_TCP6_REP].size > 0
+	$tinetCfgC.add()
+	$tinetCfgC.add("T_TCP6_REP tcp6_rep[TNUM_TCP6_REPID] = {")
+	$cfgData[:TCP6_CRE_REP].each do |key, params|
+		$tinetCfgC.add("\t{")
+			$tinetCfgC.add("\t\t#{params[:tcp6_repatr]},")
+			$tinetCfgC.add("\t\t{ #{params[:ipv6addr]}, #{params[:portno]} },")
+		$tinetCfgC.add("#if defined(TCP_CFG_EXTENTIONS)")
+			$tinetCfgC.add("\t\tTCP_REP_FLG_VALID,")
+			$tinetCfgC.add("\t\tSEM_TCP_REP_LOCK#{$sem_tcp_rep_lock_id},")
+		$tinetCfgC.add("#endif")
+			$tinetCfgC.add("\t\t},")
+		$sem_tcp_rep_lock_id = $sem_tcp_rep_lock_id + 1
+	end
+	$cfgData[:VRID_TCP6_REP].each do |key, params|
+		$tinetCfgC.add("\t{")
+			$tinetCfgC.add("\t\t0,")
+			$tinetCfgC.add("\t\t{ IPV6_ADDRANY, TCP_PORTANY },")
+	$tinetCfgC.add("#if defined(TCP_CFG_EXTENTIONS)")
+			$tinetCfgC.add("\t\tTCP_REP_FLG_DYNAMIC,")
+			$tinetCfgC.add("\t\tSEM_TCP_REP_LOCK#{$sem_tcp_rep_lock_id},")
+	$tinetCfgC.add("#endif")
+			$tinetCfgC.add("\t\t},")
+		$sem_tcp_rep_lock_id = $sem_tcp_rep_lock_id + 1
+	end
+	$tinetCfgC.add("\t};")
+end
+
 #	// TCP (IPv4) 受付口
-if $cfgData[:TCP_CRE_REP].size > 0 || $cfgData[:VRID_TCP4_REP].size > 0
+if $cfgData[:TCP_CRE_REP].size > 0 || $cfgData[:VRID_TCP_REP].size > 0
 	$tinetCfgC.add()
-	$tinetCfgC.add("#define TNUM_TCP_REPID	#{$cfgData[:TCP_CRE_REP].size + $cfgData[:VRID_TCP4_REP].size}")
-	$tinetCfgC.add()
-	$tinetCfgC.add("const ID tmax_tcp_repid = (TMIN_TCP_REPID + TNUM_TCP_REPID - 1);")
-	$tinetCfgC.add()
-	$tinetCfgC.add("T_TCP_REP tcp_rep[TNUM_TCP_REPID] = {")
+	$tinetCfgC.add("T_TCP4_REP tcp4_rep[TNUM_TCP4_REPID] = {")
 	$cfgData[:TCP_CRE_REP].each do |key, params|
 		$tinetCfgC.add("\t{")
@@ -144,9 +213,10 @@
 	$tinetCfgC.add("#if defined(TCP_CFG_EXTENTIONS)")
 			$tinetCfgC.add("\t\tTCP_REP_FLG_VALID,")
-			$tinetCfgC.add("\t\tSEM_TCP_REP_LOCK#{params[:tcp4_repid].val},")
+			$tinetCfgC.add("\t\tSEM_TCP_REP_LOCK#{$sem_tcp_rep_lock_id},")
 	$tinetCfgC.add("#endif")
 			$tinetCfgC.add("\t\t},")
-	end
-	$cfgData[:VRID_TCP4_REP].each do |key, params|
+		$sem_tcp_rep_lock_id = $sem_tcp_rep_lock_id + 1
+	end
+	$cfgData[:VRID_TCP_REP].each do |key, params|
 		$tinetCfgC.add("\t{")
 			$tinetCfgC.add("\t\t0,")
@@ -154,91 +224,16 @@
 	$tinetCfgC.add("#if defined(TCP_CFG_EXTENTIONS)")
 			$tinetCfgC.add("\t\tTCP_REP_FLG_DYNAMIC,")
-			$tinetCfgC.add("\t\tSEM_TCP_REP_LOCK#{params[:vrid_tcp4_repid].val + $cfgData[:TCP_CRE_REP].size},")
+			$tinetCfgC.add("\t\tSEM_TCP_REP_LOCK#{$sem_tcp_rep_lock_id},")
 	$tinetCfgC.add("#endif")
 			$tinetCfgC.add("\t\t},")
-	end
-		$tinetCfgC.add("\t};")
-end
-
-#	// TCP (IPv6) 受付口
-if $cfgData[:TCP6_CRE_REP].size > 0 || $cfgData[:VRID_TCP6_REP].size > 0
+		$sem_tcp_rep_lock_id = $sem_tcp_rep_lock_id + 1
+	end
+	$tinetCfgC.add("\t};")
+end
+
+#	// TCP 通信端点
+if $cfgData[:TCP6_CRE_CEP].size > 0 || $cfgData[:VRID_TCP6_CEP].size > 0 || $cfgData[:TCP_CRE_CEP].size > 0 || $cfgData[:VRID_TCP_CEP].size > 0
 	$tinetCfgC.add()
-	$tinetCfgC.add("#define TNUM_TCP_REPID	#{$cfgData[:TCP6_CRE_REP].size + $cfgData[:VRID_TCP6_REP].size}")
-	$tinetCfgC.add()
-	$tinetCfgC.add("const ID tmax_tcp_repid = (TMIN_TCP_REPID + TNUM_TCP_REPID - 1);")
-	$tinetCfgC.add()
-	$tinetCfgC.add("T_TCP6_REP tcp_rep[TNUM_TCP_REPID] = {")
-	$cfgData[:TCP6_CRE_REP].each do |key, params|
-		$tinetCfgC.add("\t{")
-			$tinetCfgC.add("\t\t#{params[:tcp6_repatr]},")
-			$tinetCfgC.add("\t\t{ #{params[:ipv6addr]}, #{params[:portno]} },")
-	$tinetCfgC.add("#if defined(TCP_CFG_EXTENTIONS)")
-			$tinetCfgC.add("\t\tTCP_REP_FLG_VALID,")
-			$tinetCfgC.add("\t\tSEM_TCP_REP_LOCK#{params[:tcp6_repid].val},")
-	$tinetCfgC.add("#endif")
-			$tinetCfgC.add("\t\t},")
-	end
-	$cfgData[:VRID_TCP6_REP].each do |key, params|
-		$tinetCfgC.add("\t{")
-			$tinetCfgC.add("\t\t0,")
-			$tinetCfgC.add("\t\t{ IPV6_ADDRANY, TCP_PORTANY },")
-	$tinetCfgC.add("#if defined(TCP_CFG_EXTENTIONS)")
-			$tinetCfgC.add("\t\tTCP_REP_FLG_DYNAMIC,")
-			$tinetCfgC.add("\t\tSEM_TCP_REP_LOCK#{params[:vrid_tcp6_repid].val + $cfgData[:TCP6_CRE_REP].size},")
-	$tinetCfgC.add("#endif")
-			$tinetCfgC.add("\t\t},")
-	end
-		$tinetCfgC.add("\t};")
-end
-
-#	// TCP (IPv4) 通信端点
-if $cfgData[:TCP_CRE_CEP].size > 0 || $cfgData[:VRID_TCP4_CEP].size > 0
-	$tinetCfgC.add()
-	$tinetCfgC.add("#define TNUM_TCP_CEPID	#{$cfgData[:TCP_CRE_CEP].size + $cfgData[:VRID_TCP4_CEP].size}")
-	$tinetCfgC.add()
-	$tinetCfgC.add("const ID tmax_tcp_cepid = (TMIN_TCP_CEPID + TNUM_TCP_CEPID - 1);")
-	$tinetCfgC.add()
-	$tinetCfgC.add("T_TCP_CEP tcp_cep[TNUM_TCP_CEPID] = {")
-	$cfgData[:TCP_CRE_CEP].each do |key, params|
-		$tinetCfgC.add("\t{")
-			$tinetCfgC.add("\t\t#{params[:tcp4_cepatr]},")
-			$tinetCfgC.add("\t\t(void*)#{params[:sbuf]},")
-			$tinetCfgC.add("\t\t#{params[:sbufsz]},")
-			$tinetCfgC.add("\t\t(void*)#{params[:rbuf]},")
-			$tinetCfgC.add("\t\t#{params[:rbufsz]},")
-			$tinetCfgC.add("\t\t(t_tcp_callback)(FP)#{params[:callback]},")
-			$tinetCfgC.add("\t\tTCP_CEP_FLG_VALID,")
-			$tinetCfgC.add("\t\tSEM_TCP_CEP_LOCK#{params[:tcp4_cepid].val},")
-			$tinetCfgC.add("\t\tFLG_TCP_CEP_EST#{params[:tcp4_cepid].val},")
-			$tinetCfgC.add("\t\tFLG_TCP_CEP_SND#{params[:tcp4_cepid].val},")
-			$tinetCfgC.add("\t\tFLG_TCP_CEP_RCV#{params[:tcp4_cepid].val},")
-			$tinetCfgC.add("\t\t},")
-	end
-	$cfgData[:VRID_TCP4_CEP].each do |key, params|
-		$tinetCfgC.add("\t{")
-			$tinetCfgC.add("\t\t0,")
-			$tinetCfgC.add("\t\t(void*)NULL,")
-			$tinetCfgC.add("\t\t0,")
-			$tinetCfgC.add("\t\t(void*)NULL,")
-			$tinetCfgC.add("\t\t0,")
-			$tinetCfgC.add("\t\t(t_tcp_callback)(FP)NULL,")
-			$tinetCfgC.add("\t\tTCP_CEP_FLG_DYNAMIC,")
-			$tinetCfgC.add("\t\tSEM_TCP_CEP_LOCK#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size},")
-			$tinetCfgC.add("\t\tFLG_TCP_CEP_EST#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size},")
-			$tinetCfgC.add("\t\tFLG_TCP_CEP_SND#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size},")
-			$tinetCfgC.add("\t\tFLG_TCP_CEP_RCV#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size},")
-			$tinetCfgC.add("\t\t},")
-	end
-		$tinetCfgC.add("\t};")
-end
-
-#	// TCP (IPv6) 通信端点
-if $cfgData[:TCP6_CRE_CEP].size > 0 || $cfgData[:VRID_TCP6_CEP].size > 0
-	$tinetCfgC.add()
-	$tinetCfgC.add("#define TNUM_TCP_CEPID	#{$cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}")
-	$tinetCfgC.add()
-	$tinetCfgC.add("const ID tmax_tcp_cepid = (TMIN_TCP_CEPID + TNUM_TCP_CEPID - 1);")
-	$tinetCfgC.add()
-	$tinetCfgC.add("T_TCP6_CEP tcp_cep[TNUM_TCP_CEPID] = {")
+	$tinetCfgC.add("T_TCP_CEP tcp_cep[TNUM_TCP6_CEPID + TNUM_TCP4_CEPID] = {")
 	$cfgData[:TCP6_CRE_CEP].each do |key, params|
 		$tinetCfgC.add("\t{")
@@ -271,15 +266,72 @@
 			$tinetCfgC.add("\t\t},")
 	end
+	$cfgData[:TCP_CRE_CEP].each do |key, params|
+		$tinetCfgC.add("\t{")
+			$tinetCfgC.add("\t\t#{params[:tcp4_cepatr]},")
+			$tinetCfgC.add("\t\t(void*)#{params[:sbuf]},")
+			$tinetCfgC.add("\t\t#{params[:sbufsz]},")
+			$tinetCfgC.add("\t\t(void*)#{params[:rbuf]},")
+			$tinetCfgC.add("\t\t#{params[:rbufsz]},")
+			$tinetCfgC.add("\t\t(t_tcp_callback)(FP)#{params[:callback]},")
+			$tinetCfgC.add("\t\tTCP_CEP_FLG_VALID|TCP_CEP_FLG_IPV4,")
+			$tinetCfgC.add("\t\tSEM_TCP_CEP_LOCK#{params[:tcp4_cepid].val + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size},")
+			$tinetCfgC.add("\t\tFLG_TCP_CEP_EST#{params[:tcp4_cepid].val + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size},")
+			$tinetCfgC.add("\t\tFLG_TCP_CEP_SND#{params[:tcp4_cepid].val + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size},")
+			$tinetCfgC.add("\t\tFLG_TCP_CEP_RCV#{params[:tcp4_cepid].val + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size},")
+			$tinetCfgC.add("\t\t},")
+	end
+	$cfgData[:VRID_TCP_CEP].each do |key, params|
+		$tinetCfgC.add("\t{")
+			$tinetCfgC.add("\t\t0,")
+			$tinetCfgC.add("\t\t(void*)NULL,")
+			$tinetCfgC.add("\t\t0,")
+			$tinetCfgC.add("\t\t(void*)NULL,")
+			$tinetCfgC.add("\t\t0,")
+			$tinetCfgC.add("\t\t(t_tcp_callback)(FP)NULL,")
+			$tinetCfgC.add("\t\tTCP_CEP_FLG_DYNAMIC|TCP_CEP_FLG_IPV4,")
+			$tinetCfgC.add("\t\tSEM_TCP_CEP_LOCK#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size},")
+			$tinetCfgC.add("\t\tFLG_TCP_CEP_EST#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size},")
+			$tinetCfgC.add("\t\tFLG_TCP_CEP_SND#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size},")
+			$tinetCfgC.add("\t\tFLG_TCP_CEP_RCV#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size},")
+			$tinetCfgC.add("\t\t},")
+	end
 		$tinetCfgC.add("\t};")
 end
 
+#	// UDP (IPv6) 通信端点
+if $cfgData[:UDP6_CRE_CEP].size > 0 || $cfgData[:VRID_UDP6_CEP].size > 0
+	$tinetCfgC.add()
+	$tinetCfgC.add("T_UDP6_CEP udp6_cep[TNUM_UDP6_CEPID] = {")
+	$cfgData[:UDP6_CRE_CEP].each do |key, params|
+		$tinetCfgC.add("\t{")
+			$tinetCfgC.add("\t\t#{params[:udp6_cepatr]},")
+			$tinetCfgC.add("\t\t{ #{params[:ipv6addr]}, #{params[:portno]} },")
+			$tinetCfgC.add("\t\t(t_udp_callback)(FP)#{params[:callback]},")
+			$tinetCfgC.add("\t\tUDP_CEP_FLG_VALID,")
+			$tinetCfgC.add("\t\tSEM_UDP6_CEP_LOCK#{params[:udp6_cepid].val},")
+			$tinetCfgC.add("\t\tTA_NULL,")
+			$tinetCfgC.add("\t\tTA_NULL,")
+			$tinetCfgC.add("\t\tDTQ_UDP6_RCVQ#{params[:udp6_cepid].val},")
+			$tinetCfgC.add("\t\t},")
+	end
+	$cfgData[:VRID_UDP6_CEP].each do |key, params|
+		$tinetCfgC.add("\t{")
+			$tinetCfgC.add("\t\t0,")
+			$tinetCfgC.add("\t\t{ IPV6_ADDRANY, UDP_PORTANY },")
+			$tinetCfgC.add("\t\t(t_udp_callback)(FP)NULL,")
+			$tinetCfgC.add("\t\tUDP_CEP_FLG_DYNAMIC,")
+			$tinetCfgC.add("\t\tSEM_UDP6_CEP_LOCK#{params[:vrid_udp6_cepid].val + $cfgData[:UDP6_CRE_CEP].size},")
+			$tinetCfgC.add("\t\tTA_NULL,")
+			$tinetCfgC.add("\t\tTA_NULL,")
+			$tinetCfgC.add("\t\tDTQ_UDP6_RCVQ#{params[:vrid_udp6_cepid].val + $cfgData[:UDP6_CRE_CEP].size},")
+			$tinetCfgC.add("\t\t},")
+	end
+		$tinetCfgC.add("\t};")
+end
+
 #	// UDP (IPv4) 通信端点
-if $cfgData[:UDP_CRE_CEP].size > 0 || $cfgData[:VRID_UDP4_CEP].size > 0
+if $cfgData[:UDP_CRE_CEP].size > 0 || $cfgData[:VRID_UDP_CEP].size > 0
 	$tinetCfgC.add()
-	$tinetCfgC.add("#define TNUM_UDP_CEPID	#{$cfgData[:UDP_CRE_CEP].size + $cfgData[:VRID_UDP4_CEP].size}")
-	$tinetCfgC.add()
-	$tinetCfgC.add("const ID tmax_udp_cepid = (TMIN_UDP_CEPID + TNUM_UDP_CEPID - 1);")
-	$tinetCfgC.add()
-	$tinetCfgC.add("T_UDP_CEP udp_cep[TNUM_UDP_CEPID] = {")
+	$tinetCfgC.add("T_UDP4_CEP udp4_cep[TNUM_UDP4_CEPID] = {")
 	$cfgData[:UDP_CRE_CEP].each do |key, params|
 		$tinetCfgC.add("\t{")
@@ -288,11 +340,11 @@
 			$tinetCfgC.add("\t\t(t_udp_callback)(FP)#{params[:callback]},")
 			$tinetCfgC.add("\t\tUDP_CEP_FLG_VALID,")
-			$tinetCfgC.add("\t\tSEM_UDP_CEP_LOCK#{params[:udp4_cepid].val},")
-			$tinetCfgC.add("\t\tTA_NULL,")
-			$tinetCfgC.add("\t\tTA_NULL,")
-			$tinetCfgC.add("\t\tDTQ_UDP_RCVQ#{params[:udp4_cepid].val},")
-			$tinetCfgC.add("\t\t},")
-	end
-	$cfgData[:VRID_UDP4_CEP].each do |key, params|
+			$tinetCfgC.add("\t\tSEM_UDP4_CEP_LOCK#{params[:udp4_cepid].val},")
+			$tinetCfgC.add("\t\tTA_NULL,")
+			$tinetCfgC.add("\t\tTA_NULL,")
+			$tinetCfgC.add("\t\tDTQ_UDP4_RCVQ#{params[:udp4_cepid].val},")
+			$tinetCfgC.add("\t\t},")
+	end
+	$cfgData[:VRID_UDP_CEP].each do |key, params|
 		$tinetCfgC.add("\t{")
 			$tinetCfgC.add("\t\t0,")
@@ -300,8 +352,8 @@
 			$tinetCfgC.add("\t\t(t_udp_callback)(FP)NULL,")
 			$tinetCfgC.add("\t\tUDP_CEP_FLG_DYNAMIC,")
-			$tinetCfgC.add("\t\tSEM_UDP_CEP_LOCK#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size},")
-			$tinetCfgC.add("\t\tTA_NULL,")
-			$tinetCfgC.add("\t\tTA_NULL,")
-			$tinetCfgC.add("\t\tDTQ_UDP_RCVQ#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size},")
+			$tinetCfgC.add("\t\tSEM_UDP4_CEP_LOCK#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size},")
+			$tinetCfgC.add("\t\tTA_NULL,")
+			$tinetCfgC.add("\t\tTA_NULL,")
+			$tinetCfgC.add("\t\tDTQ_UDP4_RCVQ#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size},")
 			$tinetCfgC.add("\t\t},")
 	end
@@ -309,136 +361,54 @@
 end
 
-#	// UDP (IPv6) 通信端点
-if $cfgData[:UDP6_CRE_CEP].size > 0 || $cfgData[:VRID_UDP6_CEP].size > 0
-	$tinetCfgC.add()
-	$tinetCfgC.add("#define TNUM_UDP_CEPID	#{cfgData[:UDP6_CRE_CEP].size + $cfgData[:VRID_UDP6_CEP].size}")
-	$tinetCfgC.add()
-	$tinetCfgC.add("const ID tmax_udp_cepid = (TMIN_UDP_CEPID + TNUM_UDP_CEPID - 1);")
-	$tinetCfgC.add()
-	$tinetCfgC.add("T_UDP6_CEP udp_cep[TNUM_UDP_CEPID] = {")
-	$cfgData[:UDP6_CRE_CEP].each do |key, params|
-		$tinetCfgC.add("\t{")
-			$tinetCfgC.add("\t\t#{params[:udp6_cepatr]},")
-			$tinetCfgC.add("\t\t{ #{params[:ipv6addr]}, #{params[:portno]} },")
-			$tinetCfgC.add("\t\t(t_udp_callback)(FP)#{params[:callback]},")
-			$tinetCfgC.add("\t\tUDP_CEP_FLG_VALID,")
-			$tinetCfgC.add("\t\tSEM_UDP_CEP_LOCK#{params[:udp6_cepid].val},")
-			$tinetCfgC.add("\t\tTA_NULL,")
-			$tinetCfgC.add("\t\tTA_NULL,")
-			$tinetCfgC.add("\t\tDTQ_UDP_RCVQ#{params[:udp6_cepid].val},")
-			$tinetCfgC.add("\t\t},")
-	end
-	$cfgData[:VRID_UDP6_CEP].each do |key, params|
-		$tinetCfgC.add("\t{")
-			$tinetCfgC.add("\t\t0,")
-			$tinetCfgC.add("\t\t{ IPV6_ADDRANY, UDP_PORTANY },")
-			$tinetCfgC.add("\t\t(t_udp_callback)(FP)NULL,")
-			$tinetCfgC.add("\t\tUDP_CEP_FLG_DYNAMIC,")
-			$tinetCfgC.add("\t\tSEM_UDP_CEP_LOCK#{params[:vrid_udp6_cepid].val + $cfgData[:UDP6_CRE_CEP].size},")
-			$tinetCfgC.add("\t\tTA_NULL,")
-			$tinetCfgC.add("\t\tTA_NULL,")
-			$tinetCfgC.add("\t\tDTQ_UDP_RCVQ#{params[:vrid_udp6_cepid].val + $cfgData[:UDP6_CRE_CEP].size},")
-			$tinetCfgC.add("\t\t},")
-	end
-		$tinetCfgC.add("\t};")
-end
-
 # =====================================================================
 # tinet_kern.cfg の生成
 # =====================================================================
 
-#	// TCP (IPv4) 受付口
-if $cfgData[:TCP_CRE_REP].size > 0 || $cfgData[:VRID_TCP4_REP].size > 0
-	$cfgData[:TCP_CRE_REP].each do |key, params|
-		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_TCP_REP_LOCK#{params[:tcp4_repid].val}"
-		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
-		cfgInfo["isemcnt"] = 1
-		cfgInfo["maxsem"] = 1
-		$cfgFileInfo.push(cfgInfo)
-	end
-	$cfgData[:VRID_TCP4_REP].each do |key, params|
-		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_TCP_REP_LOCK#{params[:vrid_tcp4_repid].val + $cfgData[:TCP_CRE_REP].size}"
-		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
-		cfgInfo["isemcnt"] = 1
-		cfgInfo["maxsem"] = 1
-		$cfgFileInfo.push(cfgInfo)
-	end
-end
-
 #	// TCP (IPv6) 受付口
+$sem_tcp_rep_lock_id = 0
 if $cfgData[:TCP6_CRE_REP].size > 0 || $cfgData[:VRID_TCP6_REP].size > 0
 	$cfgData[:TCP6_CRE_REP].each do |key, params|
 		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_TCP_REP_LOCK#{params[:tcp6_repid].val}"
-		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
-		cfgInfo["isemcnt"] = 1
-		cfgInfo["maxsem"] = 1
-		$cfgFileInfo.push(cfgInfo)
+		cfgInfo["semid"] = "SEM_TCP_REP_LOCK#{$sem_tcp_rep_lock_id}"
+		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
+		cfgInfo["isemcnt"] = 1
+		cfgInfo["maxsem"] = 1
+		$cfgFileInfo.push(cfgInfo)
+
+		$sem_tcp_rep_lock_id = $sem_tcp_rep_lock_id + 1
 	end
 	$cfgData[:VRID_TCP6_REP].each do |key, params|
 		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_TCP_REP_LOCK#{params[:vrid_tcp6_repid].val + $cfgData[:TCP6_CRE_REP].size}"
-		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
-		cfgInfo["isemcnt"] = 1
-		cfgInfo["maxsem"] = 1
-		$cfgFileInfo.push(cfgInfo)
-	end
-end
-
-#	// TCP (IPv4) 通信端点
-if $cfgData[:TCP_CRE_CEP].size > 0 || $cfgData[:VRID_TCP4_CEP].size > 0
-	$cfgData[:TCP_CRE_CEP].each do |key, params|
-		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_TCP_CEP_LOCK#{params[:tcp4_cepid].val}"
-		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
-		cfgInfo["isemcnt"] = 1
-		cfgInfo["maxsem"] = 1
-		$cfgFileInfo.push(cfgInfo)
-
-		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_EST#{params[:tcp4_cepid].val}"
-		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
-		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
-		$cfgFileInfo.push(cfgInfo)
-
-		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_SND#{params[:tcp4_cepid].val}"
-		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
-		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
-		$cfgFileInfo.push(cfgInfo)
-
-		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_RCV#{params[:tcp4_cepid].val}"
-		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
-		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
-		$cfgFileInfo.push(cfgInfo)
-	end
-	$cfgData[:VRID_TCP4_CEP].each do |key, params|
-		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_TCP_CEP_LOCK#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size}"
-		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
-		cfgInfo["isemcnt"] = 1
-		cfgInfo["maxsem"] = 1
-		$cfgFileInfo.push(cfgInfo)
-
-		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_EST#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size}"
-		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
-		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
-		$cfgFileInfo.push(cfgInfo)
-
-		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_SND#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size}"
-		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
-		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
-		$cfgFileInfo.push(cfgInfo)
-
-		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_RCV#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size}"
-		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
-		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
-		$cfgFileInfo.push(cfgInfo)
+		cfgInfo["semid"] = "SEM_TCP_REP_LOCK#{$sem_tcp_rep_lock_id}"
+		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
+		cfgInfo["isemcnt"] = 1
+		cfgInfo["maxsem"] = 1
+		$cfgFileInfo.push(cfgInfo)
+
+		$sem_tcp_rep_lock_id = $sem_tcp_rep_lock_id + 1
+	end
+end
+
+#	// TCP (IPv4) 受付口
+if $cfgData[:TCP_CRE_REP].size > 0 || $cfgData[:VRID_TCP_REP].size > 0
+	$cfgData[:TCP_CRE_REP].each do |key, params|
+		cfgInfo = { APINAME: "CRE_SEM" }
+		cfgInfo["semid"] = "SEM_TCP_REP_LOCK#{$sem_tcp_rep_lock_id}"
+		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
+		cfgInfo["isemcnt"] = 1
+		cfgInfo["maxsem"] = 1
+		$cfgFileInfo.push(cfgInfo)
+
+		$sem_tcp_rep_lock_id = $sem_tcp_rep_lock_id + 1
+	end
+	$cfgData[:VRID_TCP_REP].each do |key, params|
+		cfgInfo = { APINAME: "CRE_SEM" }
+		cfgInfo["semid"] = "SEM_TCP_REP_LOCK#{$sem_tcp_rep_lock_id}"
+		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
+		cfgInfo["isemcnt"] = 1
+		cfgInfo["maxsem"] = 1
+		$cfgFileInfo.push(cfgInfo)
+
+		$sem_tcp_rep_lock_id = $sem_tcp_rep_lock_id + 1
 	end
 end
@@ -463,23 +433,79 @@
 		cfgInfo["flgid"] = "FLG_TCP_CEP_SND#{params[:tcp6_cepid].val}"
 		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
+		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_SWBUF_READY, "TCP_CEP_EVT_SWBUF_READY")
+		$cfgFileInfo.push(cfgInfo)
+
+		cfgInfo = { APINAME: "CRE_FLG" }
+		cfgInfo["flgid"] = "FLG_TCP_CEP_RCV#{params[:tcp6_cepid].val}"
+		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
+		cfgInfo["iflgptn"] = 0
+		$cfgFileInfo.push(cfgInfo)
+	end
+	$cfgData[:VRID_TCP6_CEP].each do |key, params|
+		cfgInfo = { APINAME: "CRE_SEM" }
+		cfgInfo["semid"] = "SEM_TCP_CEP_LOCK#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}"
+		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
+		cfgInfo["isemcnt"] = 1
+		cfgInfo["maxsem"] = 1
+		$cfgFileInfo.push(cfgInfo)
+
+		cfgInfo = { APINAME: "CRE_FLG" }
+		cfgInfo["flgid"] = "FLG_TCP_CEP_EST#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}"
+		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
 		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
 		$cfgFileInfo.push(cfgInfo)
 
 		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_RCV#{params[:tcp6_cepid].val}"
+		cfgInfo["flgid"] = "FLG_TCP_CEP_SND#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}"
+		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
+		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_SWBUF_READY, "TCP_CEP_EVT_SWBUF_READY")
+		$cfgFileInfo.push(cfgInfo)
+
+		cfgInfo = { APINAME: "CRE_FLG" }
+		cfgInfo["flgid"] = "FLG_TCP_CEP_RCV#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}"
+		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
+		cfgInfo["iflgptn"] = 0
+		$cfgFileInfo.push(cfgInfo)
+	end
+end
+
+#	// TCP (IPv4) 通信端点
+if $cfgData[:TCP_CRE_CEP].size > 0 || $cfgData[:VRID_TCP_CEP].size > 0
+	$cfgData[:TCP_CRE_CEP].each do |key, params|
+		cfgInfo = { APINAME: "CRE_SEM" }
+		cfgInfo["semid"] = "SEM_TCP_CEP_LOCK#{params[:tcp4_cepid].val + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}"
+		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
+		cfgInfo["isemcnt"] = 1
+		cfgInfo["maxsem"] = 1
+		$cfgFileInfo.push(cfgInfo)
+
+		cfgInfo = { APINAME: "CRE_FLG" }
+		cfgInfo["flgid"] = "FLG_TCP_CEP_EST#{params[:tcp4_cepid].val + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}"
 		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
 		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
 		$cfgFileInfo.push(cfgInfo)
-	end
-	$cfgData[:VRID_TCP6_CEP].each do |key, params|
-		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_TCP_CEP_LOCK#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}"
-		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
-		cfgInfo["isemcnt"] = 1
-		cfgInfo["maxsem"] = 1
-		$cfgFileInfo.push(cfgInfo)
-
-		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_EST#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}"
+
+		cfgInfo = { APINAME: "CRE_FLG" }
+		cfgInfo["flgid"] = "FLG_TCP_CEP_SND#{params[:tcp4_cepid].val + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}"
+		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
+		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_SWBUF_READY, "TCP_CEP_EVT_SWBUF_READY")
+		$cfgFileInfo.push(cfgInfo)
+
+		cfgInfo = { APINAME: "CRE_FLG" }
+		cfgInfo["flgid"] = "FLG_TCP_CEP_RCV#{params[:tcp4_cepid].val + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}"
+		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
+		cfgInfo["iflgptn"] = 0
+		$cfgFileInfo.push(cfgInfo)
+	end
+	$cfgData[:VRID_TCP_CEP].each do |key, params|
+		cfgInfo = { APINAME: "CRE_SEM" }
+		cfgInfo["semid"] = "SEM_TCP_CEP_LOCK#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}"
+		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
+		cfgInfo["isemcnt"] = 1
+		cfgInfo["maxsem"] = 1
+		$cfgFileInfo.push(cfgInfo)
+
+		cfgInfo = { APINAME: "CRE_FLG" }
+		cfgInfo["flgid"] = "FLG_TCP_CEP_EST#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}"
 		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
 		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
@@ -487,22 +513,22 @@
 
 		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_SND#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}"
-		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
-		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
-		$cfgFileInfo.push(cfgInfo)
-
-		cfgInfo = { APINAME: "CRE_FLG" }
-		cfgInfo["flgid"] = "FLG_TCP_CEP_RCV#{params[:vrid_tcp6_cepid].val + $cfgData[:TCP6_CRE_CEP].size}"
-		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
-		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_CLOSED, "TCP_CEP_EVT_CLOSED")
-		$cfgFileInfo.push(cfgInfo)
-	end
-end
-
-#	// UDP (IPv4) 通信端点
-if $cfgData[:UDP_CRE_CEP].size > 0 || $cfgData[:VRID_UDP4_CEP].size > 0
-	$cfgData[:UDP_CRE_CEP].each do |key, params|
-		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_UDP_CEP_LOCK#{params[:udp4_cepid].val}"
+		cfgInfo["flgid"] = "FLG_TCP_CEP_SND#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}"
+		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
+		cfgInfo["iflgptn"] = NumStr.new($TCP_CEP_EVT_SWBUF_READY, "TCP_CEP_EVT_SWBUF_READY")
+		$cfgFileInfo.push(cfgInfo)
+
+		cfgInfo = { APINAME: "CRE_FLG" }
+		cfgInfo["flgid"] = "FLG_TCP_CEP_RCV#{params[:vrid_tcp4_cepid].val + $cfgData[:TCP_CRE_CEP].size + $cfgData[:TCP6_CRE_CEP].size + $cfgData[:VRID_TCP6_CEP].size}"
+		cfgInfo["flgatr"] = NumStr.new($TA_TFIFO | $TA_WSGL, "TA_TFIFO|TA_WSGL")
+		cfgInfo["iflgptn"] = 0
+		$cfgFileInfo.push(cfgInfo)
+	end
+end
+
+#	// UDP (IPv6) 通信端点
+if $cfgData[:UDP6_CRE_CEP].size > 0 || $cfgData[:VRID_UDP6_CEP].size > 0
+	$cfgData[:UDP6_CRE_CEP].each do |key, params|
+		cfgInfo = { APINAME: "CRE_SEM" }
+		cfgInfo["semid"] = "SEM_UDP6_CEP_LOCK#{params[:udp6_cepid].val}"
 		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
 		cfgInfo["isemcnt"] = 1
@@ -511,5 +537,5 @@
 
 		cfgInfo = { APINAME: "CRE_DTQ" }
-		cfgInfo["dtqid"] = "DTQ_UDP_RCVQ#{params[:udp4_cepid].val}"
+		cfgInfo["dtqid"] = "DTQ_UDP6_RCVQ#{params[:udp6_cepid].val}"
 		cfgInfo["dtqatr"] = NumStr.new($TA_TFIFO, "TA_TFIFO")
 		cfgInfo["dtqcnt"] = NumStr.new($NUM_DTQ_UDP_RCVQ, "NUM_DTQ_UDP_RCVQ")
@@ -517,7 +543,7 @@
 		$cfgFileInfo.push(cfgInfo)
 	end
-	$cfgData[:VRID_UDP4_CEP].each do |key, params|
-		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_UDP_CEP_LOCK#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size}"
+	$cfgData[:VRID_UDP6_CEP].each do |key, params|
+		cfgInfo = { APINAME: "CRE_SEM" }
+		cfgInfo["semid"] = "SEM_UDP6_CEP_LOCK#{params[:vrid_udp6_cepid].val + $cfgData[:UDP6_CRE_CEP].size}"
 		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
 		cfgInfo["isemcnt"] = 1
@@ -526,5 +552,5 @@
 
 		cfgInfo = { APINAME: "CRE_DTQ" }
-		cfgInfo["dtqid"] = "DTQ_UDP_RCVQ#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size}"
+		cfgInfo["dtqid"] = "DTQ_UDP6_RCVQ#{params[:vrid_udp6_cepid].val + $cfgData[:UDP6_CRE_CEP].size}"
 		cfgInfo["dtqatr"] = NumStr.new($TA_TFIFO, "TA_TFIFO")
 		cfgInfo["dtqcnt"] = NumStr.new($NUM_DTQ_UDP_RCVQ, "NUM_DTQ_UDP_RCVQ")
@@ -534,9 +560,9 @@
 end
 
-#	// UDP (IPv6) 通信端点
-if $cfgData[:UDP6_CRE_CEP].size > 0 || $cfgData[:VRID_UDP6_CEP].size > 0
-	$cfgData[:UDP6_CRE_CEP].each do |key, params|
-		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_UDP_CEP_LOCK#{params[:udp6_cepid].val}"
+#	// UDP (IPv4) 通信端点
+if $cfgData[:UDP_CRE_CEP].size > 0 || $cfgData[:VRID_UDP_CEP].size > 0
+	$cfgData[:UDP_CRE_CEP].each do |key, params|
+		cfgInfo = { APINAME: "CRE_SEM" }
+		cfgInfo["semid"] = "SEM_UDP4_CEP_LOCK#{params[:udp4_cepid].val}"
 		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
 		cfgInfo["isemcnt"] = 1
@@ -545,5 +571,5 @@
 
 		cfgInfo = { APINAME: "CRE_DTQ" }
-		cfgInfo["dtqid"] = "DTQ_UDP_RCVQ#{params[:udp6_cepid].val}"
+		cfgInfo["dtqid"] = "DTQ_UDP4_RCVQ#{params[:udp4_cepid].val}"
 		cfgInfo["dtqatr"] = NumStr.new($TA_TFIFO, "TA_TFIFO")
 		cfgInfo["dtqcnt"] = NumStr.new($NUM_DTQ_UDP_RCVQ, "NUM_DTQ_UDP_RCVQ")
@@ -551,7 +577,7 @@
 		$cfgFileInfo.push(cfgInfo)
 	end
-	$cfgData[:VRID_UDP6_CEP].each do |key, params|
-		cfgInfo = { APINAME: "CRE_SEM" }
-		cfgInfo["semid"] = "SEM_UDP_CEP_LOCK#{params[:vrid_udp6_cepid].val + $cfgData[:UDP6_CRE_CEP].size}"
+	$cfgData[:VRID_UDP_CEP].each do |key, params|
+		cfgInfo = { APINAME: "CRE_SEM" }
+		cfgInfo["semid"] = "SEM_UDP4_CEP_LOCK#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size}"
 		cfgInfo["sematr"] = NumStr.new($TA_TPRI, "TA_TPRI")
 		cfgInfo["isemcnt"] = 1
@@ -560,5 +586,5 @@
 
 		cfgInfo = { APINAME: "CRE_DTQ" }
-		cfgInfo["dtqid"] = "DTQ_UDP_RCVQ#{params[:vrid_udp6_cepid].val + $cfgData[:UDP6_CRE_CEP].size}"
+		cfgInfo["dtqid"] = "DTQ_UDP4_RCVQ#{params[:vrid_udp4_cepid].val + $cfgData[:UDP_CRE_CEP].size}"
 		cfgInfo["dtqatr"] = NumStr.new($TA_TFIFO, "TA_TFIFO")
 		cfgInfo["dtqcnt"] = NumStr.new($NUM_DTQ_UDP_RCVQ, "NUM_DTQ_UDP_RCVQ")
