private void StartReceivingData(string ipAddress, int iPort)
{
try
{
if (!_bContinueReciving)
{
//initializeMainSocket(ipAddress, iPort);
_mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);//<------HERE IS RAISED THE EXCEPTION
_mSocket.Bind(new IPEndPoint(IPAddress.Parse(ipAddress), iPort));
// _mSocket.Bind(new IPEndPoint(IPAddress.Loopback, iPort));
_mSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.HeaderIncluded, true);
_mSocket.IOControl(IOControlCode.ReceiveAll, new byte[4] { 1, 0, 0, 0 }, new byte[4] { 0, 0, 0, 0 });
//var 1
_mSocket.BeginReceive(_buffReceivedData, 0, _buffReceivedData.Length, SocketFlags.None,
new AsyncCallback(OnReceive), null);
initializeLocalSocket();
}
else
{
_bContinueReciving = false;
_mSocket.Close();
}
}
catch (Exception exception)
{
Debug.WriteLine(exception);
}
}
Run Code Online (Sandbox Code Playgroud)
我不明白为什么......它有效,现在却没有.有人能帮助我吗?我正在使用vlc进行流式传输,我不会收到数据包,做一些报告,然后在本地重新播放一个播放器
我正在尝试从 gradle 项目调用 webAPI。
我的 build.gradle 如下。
plugins {
id 'org.springframework.boot' version '2.1.4.RELEASE'
id 'java'
}
apply plugin: 'io.spring.dependency-management'
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
runtimeOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
compile 'org.springframework.boot:spring-boot-starter-webflux'
compile 'org.projectreactor:reactor-spring:1.0.1.RELEASE'
}
Run Code Online (Sandbox Code Playgroud)
如果我删除以下依赖项
compile 'org.springframework.boot:spring-boot-starter-webflux'
Run Code Online (Sandbox Code Playgroud)
它有效,但如果我将其添加回来。它给出了错误
Web server failed to start. Port 8080 was already in use.
Run Code Online (Sandbox Code Playgroud)
那么,我该如何解决这个问题,以便我可以使用 webclient?因为应用程序不是需要端口才能运行的 Web 应用程序。它是一种微服务。
我只想使用 Spring Boot 的 WebClient。如何在不将我的应用程序转换为 Web 应用程序的情况下使用它。
我有一个Windows应用程序,需要使用端口50005,50006但是被阻止了。
运行时,我看到以下内容netsh int ip show excludedportrange protocol=tcp:
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
5357 5357
49709 49808
49809 49908
49909 50008
50009 50108
50109 50208
50280 50379
* - Administered port exclusions.
Run Code Online (Sandbox Code Playgroud)
所以,我的机器上的东西是预留的端口49909来50008,这大概是什么原因造成我的应用程序失败。我尝试excludedportrange使用以下命令删除它:
netsh int ip delete excludedportrange protocol=tcp numberofports=100 startport=49909
Run Code Online (Sandbox Code Playgroud)
但是我看到一个错误Access is denied.,这使我认为保留该端口的任何内容都在积极运行,但是我不知道这可能是什么。
同样奇怪的是,即使我看到一个错误,在运行该命令后,如果重新启动,情况excludedportrange也会有所不同。
作为健全性检查,我还运行resmon.exe并确认端口50005和上没有任何运行50006。
我如何知道添加了excludedportrange什么?
编辑:我已经缩小到Hyper-V。如果禁用Hyper-V,则不会排除这些端口。
我将启动设置更改为支持远程 IP 托管
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://192.168.1.69:55446/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"myapplication": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
它在我的系统中运行良好。
然后我从另一个远程系统中的 tfs 下载我的项目并更改了 ipaddress 以支持远程 ip 托管并在管理员模式下运行该应用程序..但它仍然显示“无法连接网络服务器 'IIS Express'”
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://192.168.1.79:55446/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": …Run Code Online (Sandbox Code Playgroud) 我在裸机RHEL7上运行k8s集群。我正在尝试运行kubectl port-forward命令,但出现错误。
kubectl port-forward -p somepod 10000:8080
I0128 15:33:33.802226 70558 portforward.go:225] Forwarding from 127.0.0.1:10000 -> 8080
E0128 15:33:33.802334 70558 portforward.go:214] Unable to create listener: Error listen tcp6 [::1]:10000: bind: cannot assign requested address
Run Code Online (Sandbox Code Playgroud)
任何想法为什么会发生这种情况?
c# ×2
.net ×1
asp.net-core ×1
gradle ×1
iis ×1
java ×1
kubernetes ×1
netsh ×1
networking ×1
port ×1
sockets ×1
spring-boot ×1
streaming ×1
tcp ×1
video ×1
windows ×1