我試圖在使用JLAN庫的Android設備上運行服務器。 一些作品後,它似乎運行,停止。 從其他Android設備,我可以通過手動添加smb://192.168.0.10:1445的服務器來連接並查看我的共享文件夾。在Android上使用JLAN的SMB服務器:無法從PC或MAC看到共享文件夾
這裏我的問題:
1)I根的Android設備,但我不能用1024以上的端口(所以我用1445代替445)
2)從其它任何設備,我無法看到我的服務器automaticaly。 看來我的netbios或我的廣播配置不正確。
3)我嘗試連接它從MAC像一個「anonym」smb://192.168.0.10:1445。 身份驗證窗口出現,但當我確認MAC說我沒有權利或沒有任何共享文件夾。
碼的我的文件:
我的XML配置文件:
<?xml version="1.0" standalone="no"?>
<jlanserver>
<servers>
<SMB/>
<noFTP/>
<noNFS/>
</servers>
<SMB>
<host name="serveur" domain="Workgroup">
<broadcast>255.255.0.0</broadcast>
<smbdialects>Core,LanMan,NT</smbdialects>
<netBIOSSMB sessionPort="1139" namePort="1137" datagramPort="1138" platforms="linux,solaris,macosx,windows"/>
<tcpipSMB platforms = "linux,macosx,windows,solaris" port = "1445"/>
<comment>SMB Android Server</comment>
</host>
<authenticator type="local">
<class>org.alfresco.jlan.server.auth.LocalAuthenticator</class>
<mode>USER</mode>
<Debug/>
<allowGuest/>
</authenticator>
<!-- Debug -->
<sessionDebug flags="Netbios,State,Negotiate,Tree,Transact,Echo"/>
<netbiosDebug/>
<announceDebug/>
</SMB>
<shares>
<diskshare name="ESPACE" comment="Dossier de Partage">
<driver>
<class>org.alfresco.jlan.smb.server.disk.JavaFileDiskDriver</class>
<LocalPath>/tmp</LocalPath>
</driver>
<size totalSize="2T" freeSize="100G"/>-->
<accessControl default="Write"/>
</diskshare>
</shares>
<security>
<authenticator type="local">
<class>org.alfresco.jlan.server.auth.LocalAuthenticator</class>
<mode>USER</mode>
<Debug/>
<allowGuest/>
</authenticator>
</security>
<shareMapper>
<class>org.alfresco.jlan.smb.server.DefaultShareMapper</class>
<debug/>
</shareMapper>
我的主類: (Launchserver和StopServer被稱爲點擊我的活動按鈕)
package archisoft.com.smbserverandroid;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import org.alfresco.jlan.app.XMLServerConfiguration;
import org.alfresco.jlan.smb.server.CIFSConfigSection;
import org.alfresco.jlan.smb.server.SMBServer;
import java.io.InputStream;
import java.io.InputStreamReader;
public class Configuration extends ActionBarActivity {
public static final String TAG = "ServiceServerSMB";
private Button stopButton = null;
private Button startButton = null;
private XMLServerConfiguration srvConfig;
SMBServer MonServer;
// A la création
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "####### onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_configuration);
}
// Au redémarrage
@Override
public void onStart()
{
Log.d(TAG, "####### onStart");
super.onStart();
// On bind les boutons
startButton = (Button) findViewById(R.id.buttonStart);
stopButton = (Button) findViewById(R.id.buttonStop);
}
// Au retour sur l'activité
@Override
public void onResume()
{
Log.d(TAG, "####### onResume");
super.onResume();
}
// A l'arrêt
@Override
public void onStop()
{
Log.d(TAG, "####### onStop");
super.onStop();
}
@Override
public void onPause()
{
Log.d(TAG, "####### onPause");
super.onPause();
}
// Destruction
@Override
public void onDestroy() {
Log.d(TAG, "####### Destruction");
super.onDestroy();
}
// Appelé lorsque l'on clique sur "Start Server"
public void LaunchServer(View view)
{
Log.d(TAG, "####### Launch server");
try {
InputStream stream = getResources().openRawResource(R.raw.jlanconfiguration);
srvConfig = new XMLServerConfiguration();
srvConfig.loadConfiguration(new InputStreamReader(stream));
((CIFSConfigSection) srvConfig.getConfigSection(CIFSConfigSection.SectionName)).setDatagramPort(1138);
((CIFSConfigSection) srvConfig.getConfigSection(CIFSConfigSection.SectionName)).setNameServerPort(1137);
((CIFSConfigSection) srvConfig.getConfigSection(CIFSConfigSection.SectionName)).setSessionPort(1139);
CIFSConfigSection cifsConfig = (CIFSConfigSection) srvConfig.getConfigSection(CIFSConfigSection.SectionName);
MonServer = new SMBServer(srvConfig);
MonServer.startServer();
Log.d(TAG, "Lancement serveur");
} catch (Exception e) {
Log.e(TAG, "Erreur lancement serveur", e);
}
}
public void StopServer(View view)
{
Log.d(TAG, "####### StopServer");
MonServer.shutdownServer(true);
}
}
感謝所有願意幫助的人 我。 任何建議將受到歡迎。
如果您有任何問題,請隨時詢問。
此致敬禮!
安東尼
我會試一試。感謝您的鏈接。 –
嗨,問題是關於「如何創建服務器」,而不是「如何創建客戶端」。 – Filimindji